Chapter 3. Qt in General

Andreas Jakl

One of the major reasons for the success of Qt is that it is designed to be cross-platform. As a result, almost no in-depth knowledge is required about the specific platforms you want to target. The generic Qt code works everywhere; getting it on different platforms is just a matter of recompiling. Therefore, this chapter will introduce you to the general principles behind Qt. While not providing detailed in-depth explanations of every concept, the major areas are introduced to give you a quick overview of the way Qt works and how you can use it for your own purposes.

Hello World

In the previous chapter, you saw how to use the Qt Designer to create a user interface quickly. Now, we will take a look behind the scenes and develop the UI manually.

Of course, you could argue that it would be easier to use the Qt Designer instead of manually creating the necessary source code. While this argument is valid in many situations, it is still important to know how the user interface elements work, before outsourcing this task to the designer tool. Additionally, you will often have to modify or extend existing components to suit the exact needs of your application. This also requires directly working with the Qt classes.

As a first step, let us create the typical Hello World application. Of course, the aim of this application is to show the text 'Hello World' on the screen. See Figure 3.1 for a screenshot on Windows 7 and Symbian. Usually, you will use Qt Creator, ...

Get Qt for Symbian 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.