Adding widgets to a TableWidget?
Hi again with (hopefully) my last question. Is there any way to place a widget into an empty TableView grid? Actually I need buttons into 64 grids, to open filenames. Thanks ;)
You can have a look at "this":http://qt-project.org/forums/viewthread/16673 topic.
Wait a moment, it's a QTableWidget, not a QTableView, sorry! I've edited the title.
I've tried it like this:
@ ui->tableWidget->setCellWidget(3, 1, QPushButton);@
but I'm getting the following error:
expected primary-expression before ')' token
@ui->tableWidget->setCellWidget(3, 1, new QPushButton());@
I've did it myself already:
@ QPushButton *OttoButton = new QPushButton();
You need to add an instance of the widget as specified by qxoz . Check "setCellWidget":https://qt-project.org/doc/qt-5.0/qtwidgets/qtablewidget.html#setCellWidget documentation.