at first you need to apply created ui to a widget. it can be done using to ways
1. by multiply inheritance
#include "ui_mywidget.h"
class MyWidget
: public QWidget,
private Ui
::MyWidget{
....
public:
};
....
MyWidget::MyWidget(QWdiget *widget)
{
setupUi(this);
//after that you can use all control which you added in Qt Designer, e.g.
myGroupBox->hide();
...
}
#include "ui_mywidget.h"
class MyWidget: public QWidget, private Ui::MyWidget
{
....
public:
MyWidget(QWidget *widget = 0);
};
....
MyWidget::MyWidget(QWdiget *widget)
: QWidget(parent)
{
setupUi(this);
//after that you can use all control which you added in Qt Designer, e.g.
myGroupBox->hide();
...
}
To copy to clipboard, switch view to plain text mode
2. by using a class member
#include "ui_mywidget.h"
{
....
public:
private:
Ui::MyWidget m_ui;
};
....
MyWidget::MyWidget(QWdiget *widget)
{
m_ui.setupUi(this);
//after that you can use all control which you added in Qt Designer, e.g.
m_ui.myGroupBox->hide();
}
#include "ui_mywidget.h"
class MyWidget: public QWidget
{
....
public:
MyWidget(QWidget *widget = 0);
private:
Ui::MyWidget m_ui;
};
....
MyWidget::MyWidget(QWdiget *widget)
: QWidget(parent)
{
m_ui.setupUi(this);
//after that you can use all control which you added in Qt Designer, e.g.
m_ui.myGroupBox->hide();
}
To copy to clipboard, switch view to plain text mode
and then make all what you need as zgulser said.
Bookmarks