Does splitting widgets into multiple .ui
files reduce compilation time? I'm compiling on Visual Studio 2022.
Obviously, I would not add one widget per .ui
but complex widgets with a lot of children.
Also, I'm 'including' the new .ui
correctly in the code below?
ui_widget.h
is a widget.ui
created with the Visual Studio option Qt Widgets Form File
// mainwindow.h
#include <QtWidgets/QMainWindow>
#include "ui_MainWindow.h"
#include "ui_widget.h"
class MainWindow: public QMainWindow, public Ui::MainWindowClass
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
Ui::MainWindowClass ui;
Ui::Form form;
};
// mainwindow.cpp
#include "stdafx.h"
#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
ui.setupUi(this);
form.setupUi(this); // <- is this correct?
ui.stackedWidget->insertWidget(0, form.pushButton);
form.pushButton->show();
}