[Qt-interest] parse items of QTreeWidget into file/QSettings

Mystical Groovy mysticalgr at gmail.com
Sat Nov 7 13:50:21 CET 2009


Good morning everyone

does anyone know how to parse the items of a QTreeWidget into a file?
Im trying to save the list of items in  QTreeWIdget with QSettigns but
currentItem()->text(0);
 works only for one item

Iv tried to do : selectAll(); and then currentItem()->text(0) but it freezes
my program..

Some samples Ive tried

*Trying to parse the items on QSettings value*

> treeWidget->selectAll();
>
>
> settings.setValue("repositoriesLastState",treeWidget->currentItem()->text(0));
>
the above on freezes my program, segmentation fault....

* Trying to parse the items on a file for futher processing later.*

 QFile repos("/tmp/repositories");
>
> repos.open(QFile::WriteOnly | QFile::Truncate);
>
> QTextStream repoList(&repos);
>
> repoList << treeWidget->currentItem()->text(0);
>
> repos.close();
>
the above write to /tmp/repositories file only one item

Please help, thank you :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091107/5f64a1c8/attachment.html 


More information about the Qt-interest-old mailing list