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 ...
Get C++ GUI Programming with Qt 3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.