Qt Inheritance Hierarchy Tutorial

QT inheritance hierarchy is the C++ class inheritance relationships between the classes in the Qt API (Application Programming Interface). Besides having an inheritance hierarchy, Qt is split up into various modules. This article looks at both Qt inheritance hierarchy and Qt modules.

An understanding of class inheritance and the module structure of the Qt API helps with understanding the bigger picture of what Qt consists of.

Part 20 of the Qt Creator C++ Tutorial

Go to the Qt Programming Tutorial Series Table of Contents

Qt Inheritance Hierarchy

Qt inheritance hierarchy refers to the Qt C++ class hierarchy. In other words, which classes are derived from which other classes in the Qt API. The following two sub sections describe Qt inheritance.

Qt Inheritance Hierarchy Diagram

A discussion on the Qt forum indicates that there is no Qt class hierarchy diagram for new versions of Qt. It appears that because Qt has become so big, a class hierarchy diagram would be very big and impossible to read. The page at the above link is fairly old. It links to an old reference for Qt 4.3 that no longer exist. At the time of writing this article, Qt 5 is the newest version in use.

Find an example of a Qt class hierarchy diagram in the Qt for beginners wiki article. Look under the Qt class hierarchy heading on this article page. This article is fairly long. Because of the length of the article, it is necessary to scroll down a fair way to find the Qt class hierarchy heading. Below is a diagram based on the one from the above link.

Qt Inheritance Hierarchy Diagram Example
Qt Inheritance Hierarchy Diagram Example

The above diagram is an example of Qt class inheritance hierarchy of some of the Qt C++ classes. There are many more classes and relations between classes than shown in this simple example.

How to Understand the Qt Inheritance Hierarchy

As we saw in the previous section, there is no official full inheritance hierarchy diagram for Qt. To properly understand the hierarchy, consult the Qt inheritance hierarchy page. Find the Qt Inheritance Hierarchy for Qt 5 web page on the QT Documentation part of the Qt website.

The page at the above link lists all of the Qt classes and indents classes that are derived from other classes. Open any link to a class from this list. Look for the Inherits field to see what the class inherits, or which class it is derived from.

A list of all Qt 5 C++ Classes can also be useful. This is an alphabetical list of all C++ classes.

Qt Modules

The Qt framework is split into many modules. Two main categories group these modules. While the Qt inheritance hierarchy shows the relationship between Qt C++ classes, Qt modules show the higher level structure of Qt.

There are two categories of modules, namely, Qt Essentials and Qt Add-Ons. Detailed information on modules is found on the Qt documentation page for all modules. A brief description of modules follows in the two categories of essentials and add-ons.

Qt Essentials

Essential modules are modules that are general and useful in a majority of Qt applications. Some examples of Qt essentials modules are Qt Core, and Qt Widgets. For a full list of all Qt essentials and Qt add-ons modules, visit the Qt documentation page for all modules.

Qt Add-Ons

A module used for special purposes is an add-on module, even if the module is supported on all platforms. Qt add-ons modules bring additional value for specific purposes. They may only be available on some development platforms.

Leave a Reply

Your email address will not be published. Required fields are marked *