#includeIn this example, a QList of QString pointers is created and two QString objects are added to the list using the append() method. setAutoDelete() is then called to enable automatic deletion of the QString objects when the list goes out of scope. Package library: Qt Core module.#include int main() { QList myList; QString* str1 = new QString("Hello"); QString* str2 = new QString("World"); myList.append(str1); myList.append(str2); // Set the list to automatically delete its elements myList.setAutoDelete(true); // The list and its elements are automatically deleted when it goes out of scope return 0; }