Delete all elements in a QList
#include <QtGui>
#include <QDebug>
int main(int argc, char * argv[]) {
QApplication app(argc, argv);
QList<QWidget* > widgetList;
for (int i = 1; i < 10; i++)
{
widgetList.append(new QWidget);
}
qDeleteAll(widgetList.begin(), widgetList.end());
widgetList.clear();
widgetList.append(new QWidget);
return 0;
}
Related examples in the same category