Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Adding button to QTableview .
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 ?
andre last edited by
Does it need to really be a button, or is a clickable area or icon enough for your purposes?
actually i need a button only ..
could you please share some codes ?
Sam last edited by
but through QItemDelegate we can only display the widget during editing the cell..
Is there any way to display it permanently ?
[quote author="Sam" date="1343938922"]check "here":http://qt-project.org/forums/viewthread/16673/ and "here":http://qt-project.org/forums/viewthread/16837/[/quote]
Sam last edited by
In the second link its specified that you need to use "setIndexWidget()":http://qt-project.org/doc/qt-4.8/qabstractitemview.html#setIndexWidget for ItemViews and setItemWidget() for ItemWidgets. So for adding a pushButton to a tableView you need to use "setIndexWidget()":http://qt-project.org/doc/qt-4.8/qabstractitemview.html#setIndexWidget
Saved last edited by
[quote author="Andre" date="1343915387"]Does it need to really be a button, or is a clickable area or icon enough for your purposes?[/quote]
I need also something like a small button in a QTableView cell corner. But I think for me a clickable area is also ok. What was your purpose?
If I use custom widget and put in in the CustomQItemDelegates paint methode, I get only the picture of the widget and my button is not clickable.
If I use setIndexWidget, the button takes the full cell.
Which approch is better for my purpose?
andsun last edited by
@andre Hi, I'm struggling with the equal problem. However I want to just on click open upp a couple of cells for editing and change the 'button' to a save button and if clicked -perform a save of data. Is it possible with an icon/image as you suggest/ask ? How??