O'Reilly logo

C++ GUI Programming with Qt 3 by Mark Summerfield, Jasmin Blanchette

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 1. Getting Started

This chapter shows how to combine basic C++ with the functionality provided by Qt to create a few small graphical user interface (GUI) applications. This chapter also introduces two key Qt ideas: “signals and slots” and layouts. In Chapter 2, we will go into more depth, and in Chapter 3, we will start building a realistic application.

Hello Qt

Here’s a very simple Qt program:

 1 #include <qapplication.h>
 2 #include <qlabel.h>

 3 int main(int argc, char *argv[])
 4 {
 5     QApplication app (argc, argv);
 6     QLabel *label = new QLabel("Hello Qt!", 0);
 7     app.setMainWidget(label);
 8     label->show();
 9     return app.exec();
10 }

We will first study it line by line, then we will see ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required