Qt/Lesson 1

< Qt

Hello, World!Edit

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!");
    return app.exec();

To compile this, read Development Environment

Using Qt designerEdit

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.