411 REFERENCE · Wikibooks
Qt/Lesson 1
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Hello, World!
This is the Hello, World! program. It just displays a window:
#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel label("Hello, world!");
label.show();
return app.exec();
}
To compile this, read ../Development Environment/ or just use g++ `pkg-config --libs --cflags Qt5Core Qt5Widgets` main.cpp.
Using Qt designer
This lesson will get you started using Qt designer for making your own simple application.
Open Qt Designer and select to make a new dialog without buttons. Drag a label on to it and set its title property to "Hello, World!", then go to Form > Preview to see your new dialog. Now, onto writing some code. We'll have to subclass the QDialog class to make the application run standalone on most modern operating systems.
pt:Qt/Primeiro programa
pl:Programowanie_C%2B%2B_Qt4_w_systemie_Gnu-Linux/Helo_World_w_QT4