x
Loading
 Loading
Hello, Guest | Login | Register

Programming with Qt, Part 2

In the previous installment of this series, we implemented two very simple example programs, which nevertheless demonstrated quite a few of the core concepts of Qt programming. This month, let’s will take a step back and look at some of the fundamentals of programming with Qt.

In the previous installment of this series, we implemented two very simple example programs, which nevertheless demonstrated quite a few of the core concepts of Qt programming. This month, let’s will take a step back and look at some of the fundamentals of programming with Qt.

The class diagram in Figure One shows the static class structure of some of the more important Qt classes. Most classes ultimately derive from Qt. Qt doesn’t declare any member variables or functions, and contains only a number of public enums (such as DateFormat { TextDate, ISODate, LocalDate }); and since it doesn’t declare any member variables or functions, it merely provides a convenient grouping of the common enums without polluting the global namespace.

compile_01
Figure One: Part of the Qt class hierarchy

The most important direct descendant of Qt is the QObject class. This common base class provides the necessary infrastructure for Qt’s language extensions. By inheriting from QObject it’s possible for custom objects to integrate seamlessly with Qt’s object model. We’ll investigate how that’s achieved below.

Three important direct subclasses of QObject are QApplication, QWidget, and QCanvas.

Each program that makes use of Qt’s GUI elements must first instantiate exactly one QApplication object, which handles initialization of the underlying windowing system. Instantiation of QApplication also provides the main event…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. Helpful Tools for Software Developers
  2. The Github Hall of Fame
  3. Book'em, Github.
  4. This Week on Github: Stupid Ruby Tricks
  5. A Veritable Scatter Shot!
Follow Linux Magazine
Rackspace