The Jambi tree examples that I've found use the file system as the model
and relies on the filesystem to provide the parent-child relationship,
which doesn't help me.

I have a flat list of objects in a QAbstractItemModel.  I use this model
with other views so I can't just extend QTreeModel instead.  For my tree
view, I just want to use a property of each object to group the objects in
a simple 2 level tree.  Based on the parameters passed to the abstract
methods in QAbstractItemModel, I can't figure out how I can determine what
the view is requesting.  By extending QDirModel and putting print
statements in the data method, I found, for example, the (row,column) - aka
QModelIndex - for the first level in the tree is (0,0), (1,0), (2,0), etc.
If I choose one of those levels, then the children also have the same index
rows and columns: (0,0), (1,0), (2,0).  So, in the method data(QModelIndex
index, int role), how can I know what index is referring to?  Same goes for
the parent(QModelIndex child) and rowCount(QModelIndex parent) methods.
The parameters seem too vague to figure out exactly which tree item the
view is requesting: one of the groups or one of the objects in the group.

Thanks,

Josh
_______________________________________________
Qt-jambi-interest mailing list
Qt-jambi-interest@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-jambi-interest

Reply via email to