QWidget in QTreeView with Model
-
wrote on 31 Jan 2011, 11:15 last edited by
hi
i want to use my own QWidget in a QTreeView.
QTreeWidget::setItemWidget is what i'm already using, which works fine, but doesn't play very well with a QAbstractItemModel.so is there a possability to use a QTreeView with data coming from a QAbstractItemModel and showen in a QWidget?
-
wrote on 31 Jan 2011, 11:21 last edited by
You might want to use a delegate.
Examples:
http://doc.qt.nokia.com/4.7-snapshot/itemviews-spinboxdelegate.html
http://doc.qt.nokia.com/4.7-snapshot/itemviews-stardelegate.html -
wrote on 31 Jan 2011, 11:38 last edited by
so you mean i should use QItemDelegate::createEditor and flag every entry with Qt::EditRole?
i dont think i can use a delegate because the normal way would be to use QItemDelegate::paint to display the data, but i got buttons and everything in my widget and just render them as pixmap is .. well not my goal.
-
wrote on 31 Jan 2011, 12:32 last edited by
And what about this?
http://doc.qt.nokia.com/4.7/qabstractitemview.html#setIndexWidget
4/4