UI interface does not display
-
main.cpp
#include "clientSet.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
clientSet.cpp
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
Why does the client set interface not display after the program runs -
main.cpp
#include "clientSet.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
clientSet.cpp
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
Why does the client set interface not display after the program runs@bxrs
Please use the forum's Code tags (</>
toolbar button) when pasting blocks of code.I presume that
clientSet.cpp
has#include "ui_clientSet.h"
to include the.h
file generated from the.ui
file by runninguic
. And that file lives in the build output directory, not the source directory, and is being regenerated correctly?Start by replacing
MainWindow w;
byQMainWindow w;
and report back as to whether that shows correctly. Then take it from there.Reading again, I am unsure whether "Why does the client set interface not display after the program runs" means you do not see any window/widget open and appear on your desktop (per my answer above) or whether you mean you do see a main window but it is empty/does not show what you designed into the
.ui
file? If it's the latter, check what is in the.ui
file and in the generatedui_clientSet.h
file. An occasional mistake is to find a file of that name somehow lying around in your sources directory, it must not be there. The one regenerated each time from changes in the.ui
must be located in the build output directory and must not be overridden by one sitting in the source directory, check for that?