#includeint main() { QStringList fruits = {"Apple", "Banana", "Cherry", "Date"}; int count = fruits.size(); // Get number of elements return 0; }
#includeThis example creates an empty `StringList` named `names`. The `isEmpty()` function is used to check if the list is empty. If the list is empty, `isEmpty` variable will be `true`, otherwise it will be `false`. Package/library: `QtCore` from Qt framework.int main() { QStringList names; bool isEmpty = names.isEmpty(); // Check if list is empty return 0; }