How to use QTabWidget
Declaration and Adding Tabs
QTabWidget MainIFaceTab = new QTabWidget(this); MainIFaceTab->addTab(new QWidget(),"Tab1"); MainIFaceTab->addTab(new QWidget(),"Tab2");"
Getting widget back from a tab
QWidget *wgt = MainIFaceTab->widget(0); //Returns widget of Tab1(Index starts from 0)
Setting a widget to Tab
We need to 1. Create a layout. 2. Add the widget to be set to the layout 3. Set the layout to the returned widget from Tab.
QWidget *wgt = MainIFaceTab->widget(0); //Returns widget of Tab1(Index starts from 0) QVBoxLayout *vBoxLay = new QVBoxLayout; //create layout vBoxLay->addWidget(qTable); //Adds a table widget to the layout wgt->setLayout(vBoxLay); //Set the layout with the table to the returned widget.
















