[Qt-interest] QModelIndex from internal pointer in QAbstractItemModel

Simon Drouin drouin.simon at gmail.com
Fri Nov 12 17:25:53 CET 2010


Hi all,

I have a custom tree structure that I want to show in a QTreeView. I store
the elements of the tree (pointers to MyTreeItem in the example bellow) in
the internal pointer of QModelIndex. Now, how do I get the QModelIndex that
contains a specific element of my tree. I other words:

MyTreeItem * item;
QModelIdex index = ItemToIndex( item );

how do I implement the ItemToIndex function?

Thanks in advance.

s.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101112/0793d156/attachment.html 


More information about the Qt-interest-old mailing list