QStringList list; if (list.isEmpty()) { qDebug() << "The list is empty!"; }
QStringList list = {"apple", "banana", "orange"}; if (!list.isEmpty()) { qDebug() << "The list contains " << list.size() << " items!"; }In this example, we create a QStringList with three items and check if it is empty using the isEmpty method. Since it is not empty, we print a debug message saying "The list contains 3 items!". The QStringList class is part of the Qt Core library.