I would like to have a UI class in its own namespace, like ProjectName::MainWindow. Is there some convenient way how to achieve this in Qt Creator, please?
I can ope
When you create new Designer Form Class, specify class name with namespace, e.g. ProjectName::MainWindow. Qt Creator will automatically generate the following code.
MainWindow.h:
namespace ProjectName {
namespace Ui {
class MainWindow;
}
class MainWindow : public QWidget {
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
} // namespace ProjectName
MainWindow.ui:
ProjectName::MainWindow
0
0
400
300
Form
As you see, both MainWindow and Ui::MainWindow are now in ProjectName namespace.