View Full Version : Inserting a Custom Widget inside a QTableView Cell

8th September 2011, 10:23
I searched in the forum but I didn't find any good solution...I want to show in a QTableView Cell a custom widget (composed by 2 QCheckBox and 1 QSpinBox) which control/edit a specific data in my model.
I created a custom QItemDelegate in order to show the custom widget inside the cell at editing time (there are several example exaplining how to implement this)...my next feature is showing the custom widget at not editing time, i.e. I want to permanently show the custom widget inside the cell (cell Editable/NotEditable mode) without any other action on cell in order to select/edit cell...
Do you save some idea about this feaure implementation?


8th September 2011, 21:37
I suggest you search again, the issue has been discussed many times.

4th August 2012, 20:03
but through QItemDelegate we can only display the widget during editing the cell..
Is there any way to display it permanently ?

4th August 2012, 22:38
Well, you can use QAbstractItemView::openPersistentEditor, but it can "slow down" your view if there are a lot of data.
I would suggest to grab an editor using QPixmap::grabWidget or even better to render it using QWidget::render in the item's delegate QItemDelegate::paint method.