I think I got it now.
You have a QMainWindow, and when a certain event is fired, you want to change the appearance of that particular window, for example, remove some buttons, add a tree structure widget or not.
, - , , ++. , Qt Designer.
, , Qt Designer . , Qt Designer, , "ui_classname.h", . , .
, Qt Designer . , - :
MyWindow::MyWindow(QWidget *parent) : QMainWindow(parent), m_ui(new Ui::MyWindow)
{
m_ui->setupUi(this);
}
:
class MyWindow : public QMainWindow {
...
private:
Ui::MyWindow *m_ui;
};
.
:
class MyWindow : public QMainWindow {
...
private:
void changeAppearance(int id);
Ui::MyWindow *m_ui;
Ui::MyWindowFirstAppearance *m_uiFirst;
Ui::MyWindowSecondAppearance *m_uiSecond;
...
};
void MyWindow::changeAppearance(int id)
{
if (id == 0)
m_ui->setupUi(this);
else...
m_uiFirst->setupUi(this);
...
}
, , Qt Designer, . , , setupUi , , (, setupUi).