I have a QTabWidget and I would like to have two push buttons in the top right corner. I use this code to add a vertical Layout as the corner widget and add two buttons to it:
QWidget* cornerWidget = new QWidget();
QVBoxLayout* vbox = new QVBoxLayout();
QPushButton* button1 = new QPushButton("Button 1");
QPushButton* button2 = new QPushButton("Button 2");
vbox->addWidget(button1);
vbox->addWidget(button2);
ui->myTabWidget->setCornerWidget(cornerWidget);
cornerWidget->setLayout(vbox);
cornerWidget->show();
However when I run my program, no widget shows up in the top right corner at all.
If I use this simplified code to add only one push button, it works flawlessly and shows my button:
QPushButton* button1 = new QPushButton("Button 1")
ui->myTabWidget->setCornerWidget(button1);