QValueListmylist; if (mylist.isEmpty()) { cout << "List is empty" << endl; }
QValueListThis code creates a QValueList of strings and appends two values to it. Then, it checks if the list is not empty and prints the number of items in the list using the count() function. The QValueList class is part of the Qt Core module.mylist; mylist.append("Hello"); mylist.append("World"); if (!mylist.isEmpty()) { cout << "List contains " << mylist.count() << " items" << endl; }