Newbee question on QTreeView with QStandardItem and QStandardItemModel
edd101 last edited by
I'm using a QTreeView and am using the model/view approach, however I would like to store a handle in each QStandItem object and then get the display text from an api call on a given handle. I've noticed that the most of the methods in QStandardItem are not virtual so does this mean I have create my own Item class or is there an easier work around.
DerManu last edited by
First define your own QVariant for that handle type (see http://qt-project.org/doc/qt-4.8/qmetatype.html ), then use setData and data functions of QStandardItem to store/retrieve it, with an own type id, e.g. Qt::UserRole+1.