Ok so the problem is that the widget being in the stack is not a QTableWidget. It's just a QWidget (page) which has a layout containing the table widget. But if you don't put any other widget into the layout, there is no point creating an additional wrapper widget and a layout.
stackedWidget->addWidget(page_0);
//page_1 = new QWidget();
//gridLayout2 = new QGridLayout(page_1);
//gridLayout2->addWidget(imageTBL, 0, 0, 1, 1);
stackedWidget->addWidget(imageTBL);
stackedWidget = new QStackedWidget(centralwidget);
stackedWidget->addWidget(page_0);
//page_1 = new QWidget();
//gridLayout2 = new QGridLayout(page_1);
imageTBL = new QTableWidget(stackedWidget);
//gridLayout2->addWidget(imageTBL, 0, 0, 1, 1);
stackedWidget->addWidget(imageTBL);
To copy to clipboard, switch view to plain text mode
EDIT: Errr.. ignore this. I don't know what did I have on my mind. Of course the table widget needs to be in a layout so that it's geometry gets managed at all.
Bookmarks