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

Arnold Krille arnold at arnoldarts.de
Sat Nov 7 15:20:24 CET 2009


On Saturday 07 November 2009 13:50:21 Mystical Groovy wrote:
> 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
<snip>

QTreeWidget is a QTreeView with its own internal model. And as QTreeView is a 
QAbstractItemView, you should be able to traverse the model yourself (as given 
by QAbstractITemView::model()).

If its a tree, a recursive function to evaluate the branches would be 
appropriate...
And don't hesitate, the needed parts are only QModelIndex and on 
QAbstractItemModel the members rowCount, columnCount, index, parent and data.

Hope that helps,

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091107/fea0730d/attachment.bin 


More information about the Qt-interest-old mailing list