QTreeWidgetItem *item = new QTreeWidgetItem ();item->setText(0, settings.value("2").toString());m_ui.treeWidget->addTopLevelItem(item);
for(int i = 0; i< widget->topLevelItemCount(); i++) { QString val = widget->topLevelItem(i)->text(0); qDebug() << val; settings.setValue(QString::number(i), val); }