#include#include int main() { QList numbers; numbers.push_front(1); numbers.push_front(2); numbers.push_front(3); qDebug() << numbers; // Output: QList(3) << 3 << 2 << 1 return 0; }
#includeThis example creates a QList of strings, adds three strings to the front of the list using push_front() function, and then outputs the contents of the list using qDebug(). Package library: Qt library.#include int main() { QList names; names.push_front("John"); names.push_front("Alice"); names.push_front("Bob"); qDebug() << names; // Output: QList(3) << "Bob" << "Alice" << "John" return 0; }