How to control a widget which created by UI Designer ?
Solved
General and Desktop
-
Dear Sirs,
I put a tabWidget on the MainWindow, this tabWidget is drag and drop from UI designer, so there is no "QTabWidget *tabWidget" declaration on the header file.
Now I want to add a new tab by code, such as "tabWidget->addTab(button1, "Tab1");".
Obviously there is no such widget for me to use, because this object is not declared before.What should I do ?
Is there any way to tell compiler to find this object from UI designer ?
Appreciate for any comments,
-
Hi Hiloshi,
in your constructor you can use :
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->tabWidget->addTab(button1, "Tab1");" }
The ui pointer is your gate to everything you defined in Qt Designer.
Eddy
-
Hi Hiloshi,
in your constructor you can use :
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->tabWidget->addTab(button1, "Tab1");" }
The ui pointer is your gate to everything you defined in Qt Designer.
Eddy