QWidget in QTreeView with Model
-
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?
-
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 -
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.
-
And what about this?
http://doc.qt.nokia.com/4.7/qabstractitemview.html#setIndexWidget