June 2018
Intermediate to advanced
348 pages
8h 45m
English
We can now write main.cpp to create the Dialog class and display it:
#include "dialog.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Dialog dialog;
dialog.resize(545, 337);
dialog.show();
return app.exec();
}
This piece of code is exactly like the Hello World Qt application that we discussed. Instead of a QLabel, we are instantiating the Dialog class we created, resizing the dialog window frame to a predefined value by using the resize() function. Now, the application is ready to build and run. But, before building the application, let us handcode the project file:
QT += widgets
SOURCES +=
main.cpp
dialog.cpp
my_qlabel.cpp
HEADERS +=
dialog.h
my_qlabel.h
Now, build the ...