[Qt-interest] parse items of QTreeWidget into file/QSettings
André Somers
andre at familiesomers.nl
Sat Nov 7 19:31:31 CET 2009
Just like any other other QAbstractItemView derived class, QTreeWidget has a
method called model() that returns
a QAbstractItemModel. I think it could
be the model you were after
Some tips on iterating over a tree model:
· The root item(s) of your tree have an invalid parent QModelIndex,
that can be created using the default constructor of that class.
· Using rows() you can find out the number of rows (as children of a
specified parent node)
· Each node in the tree may be the parent of other nodes, but in
your case, only the nodes in column 0 may be parents of other nodes!
· You can use QAbstractItemModel::index() to create a valid index to
access the nodes of your model.
HTH,
André
Van: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] Namens Mystical Groovy
Verzonden: zaterdag 7 november 2009 17:36
Aan: Arnold Krille
CC: qt-interest at trolltech.com
Onderwerp: Re: [Qt-interest] parse items of QTreeWidget into file/QSettings
Yes maybe you're right I have to read about model/view programming, however
I dont seem to find out how to access QTreeWidget's model, Im looking at it
right Ill post if I manage to do anything :P
2009/11/7 Arnold Krille <arnold at arnoldarts.de>
Hi,
On Saturday 07 November 2009 16:39:31 Mystical Groovy wrote:
> Hi and thanks for your reply,
> I think i got it
> i wrote on my .h file
> class MyItemData : public QAbstractItemModel
<snip>
No. I said that you can access the model QTreeWidget is using. Not to
implement your own...
Sorry to say that but you want to do some serious reading on C++, object-
oriented programming (look for classes and derivation) and then patterns
(mostly the Model-View(-Controller)-pattern) and Qt...
Arnold
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091107/60b5774c/attachment.html
More information about the Qt-interest-old
mailing list