#include#include int main() { QStringList list; list.push_back("apple"); list.push_back("banana"); list.push_back("orange"); qDebug() << list; return 0; }
#includeThis code uses a for loop to add the numbers 0-9 to an empty QStringList called list. The QString::number function is used to convert the integer i to a QString before adding it to the list. The contents of the list are then printed to the console using qDebug. The QStringList class and its member functions, including push_back, are part of the Qt Core library.#include int main() { QStringList list; for (int i = 0; i < 10; ++i) { list.push_back(QString::number(i)); } qDebug() << list; return 0; }