Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Show Icon in table view without re-implementing model
Is there any way to show an icon in table view cell without re-implementing model? can't it be done by using QStandardItemModel?
Mario84 last edited by
QStandardItem::setIcon() should work...
It depends on what do you mean by reimplementing the model:
Do you have a ready made model that you want to extend or do you want to avoid any model reimplementation ?
Have a look at "QIdentityProxyModel":http://qt-project.org/doc/qt-4.8/qidentityproxymodel.html or "QStyledItemDelegate":http://qt-project.org/doc/qt-4.8/qstyleditemdelegate.html for two options
Actually no, I just have a QStandardItemModel and i want to use it in a simple form so i don't want to do extra work!!! just easiest one! I know how to do that by re-implementing data method or how to do that by writing a delegate. Is it possible?
In that case, use the suggestion from Mr.Universe, it's even simpler
francescmm last edited by
It also be possible to show an icon (if it is the same for all rows) with a Delegate class.
Thanks all i got it :) (Special Thanks for Mr.Universe!!!)