Creating First Application in QT
Open the QT
Open the QT
Select : New File or Project
Select : New File or Project
Chose Template:
Chose Template:
Other Project > Empty qmake Project
Other Project > Empty qmake Project
For New Project Give Name: FirstQTApp
For New Project Give Name: FirstQTApp
Select all kits
Select all kits
After creation you will get this window.
After creation you will get this window.
Now add new
Now add new
Select c++ source File.
Select c++ source File.
Give name main.cpp
Give name main.cpp
Click on Finish
Click on Finish
Once main.cpp file will be create , automatically sources folder will create.
Once main.cpp file will be create , automatically sources folder will create.
copy below code in FirstQTApp.pro file
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
SOURCES += \
main.cpp
in main.cpp write below code
in main.cpp write below code
#include <QApplication>
#include <QLabel>
#include <QWidget>
int main(int argc, char *argv[ ])
{
QApplication app(argc, argv);
QLabel hello("This is my First QT Application");
hello.setWindowTitle("First QT App");
hello.resize(400, 400);
hello.show();
return app.exec();
}
Run the code and get the out as shown in attached image.
Run the code and get the out as shown in attached image.