How to add a widget to QMainwindow in qt creator
-
/QTabWidget *tabWidget = new QTabWidget;
/*QWidget *tab1 = new QWidget; QWidget *tab2 = new QWidget; QWidget *tab3 = new QWidget; setCentralWidget(tabWidget); tabWidget->insertTab(0,tab1,"Table_1 Data"); tabWidget->insertTab(1,tab2,"Table2 data"); tabWidget->insertTab(2,tab2,"Table3 data");
// tabWidget->tabRemoved(0);
// ui->tabWidget->removeTab(0);
tabWidget->removeTab(2);
Here i manually creating the widgets there are attaching with QMainwindow ....I dont want to create manually need to dynamically open it need to attached to Qmainwindow....... -
@veera said in How to add a widget to QMainwindow in qt creator:
I dont want to create manually need to dynamically open it
But using addTab or insertTab IS dynamically ???????
as versus just adding them in Designer. -
- display of the tabs need join to main window
the tabs are widgets. you can add any the widgets to main window if you use a layout or another tabwidget.
if you need them as tab still, then another tabwidget is needed.
else im not sure what you mean by "join"
-
@veera You can either use real buttons or qtabwidget containing other qtabwidget and react on tab switch using
http://doc.qt.io/qt-5/qtabwidget.html#currentChanged
But I don't really understand what you're asking for...