Instantiate Qt widgets on slot of QTableView
-
Hi Folks,
I have a QTableView instance, that has two collums. The question is:
how can I instance QComboBox or QCheckbox or something like that into a slot of my QTableView?
Is there any possibility to display other widgets on the slots?Regards,
Norbert -
we have a "wiki page for that":http://qt-project.org/wiki/Combo_Boxes_in_Item_Views
for the checkbox part, have a look at checkable.
What model are you using? -
Hi,
thank you for the reply, I tried your suggestion out, but it doesn't work.
I use QTableView and QStandardItemModel. What did I make wrong?Regards
-
Did you try the example?
What exactly goes wrong?
-
Hi,
yes, I copied the example, but it doesn't displays the combobox on my QTableView. Please consider, that I'm using QTableView insted of QTableWidget.
-
What version of Qt are you using?
-
For a QTableView you could use :
@
tw.setModel(model); // your QStandardItemModel
@instead of
@
tw.setColumnCount(4);
tw.setRowCount(10);
@hope it helps