I have created one table by using QTableview and QAbstractTableModel .
In one of the cell i want to add one help button (right corner of that cell ).
Is there any way to achieve the above one ?
I have created one table by using QTableview and QAbstractTableModel .
In one of the cell i want to add one help button (right corner of that cell ).
Is there any way to achieve the above one ?
use QItemDelegate.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
can you please give a small example on this ?
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
but through QItemDelegate we can only display the widget during editing the cell..
Is there any way to display it permanently ?
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.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
thank you .. i got the concept ..But when i am using the delegate , that delegate overlapes on the existing data ..
can you please give any idea on this ?
Hi,
I am trying to "to render it using QWidget::render in the item's delegate QItemDelegate:aint method".
I took the Qt example "SpinBoxDelegate" and I try to display a QToolButton :
Qt Code:
{ if (index.column() == 1) { widget->setText("Click me"); widget->render( painter ); } else { } }To copy to clipboard, switch view to plain text mode
But nothing is displayed...
How am I supposed to create the widget ?
Hello,
i have similar issue ( displaying button in tableview), can you pls let me know how you fixed this ?
Thank you.
Just create one button image over the place you want to put button and add an event to that image which works like a button .
Bookmarks