Introduction to the QT 5 framework

Source: Internet
Author: User
Tags qt designer

The article originated in the Qter Open source community (www.qter.org), the author Yafeilinux, reprint please indicate the source.


one, see all modules in Help

Open Qt Creator, go to its help mode, then select directory mode to view, open the "Qt 5.2.0ReferenceDocumentation" page. A complete introduction to QT 5.2 is provided here, and all of its contents are categorized. We select "All Qt Modules" in the lower right corner to view all QT modules. As shown in the following figure.



On all module pages, QT modules are divided into three parts: the QT basic module (QT Essentials), the QT extension (Qt add-ons), and the QT tool (QT tools).



The QT Basic module contains the functions of the QT Core Foundation, which we will explain in detail later;


The Qt extension module contains some of the mobile-related modules in previous qtmobility, such as Bluetooth qtbluetooth, sensor qtsensors, and so on. Also included are some of the previous Qt 4 modules, such as Qtdbus, Qtxml, Qtscript, and so on. In addition, new modules have been added, such as graphic effects qtgraphicaleffects, serial Qt Serial port, and Qt3d in the commercial version. These modules are for special purposes, and many of them need to be used on special platforms. In the extension module we also see the Qt Print Support printing supporting module, which is a lot of previous classes of the reorganization module;


The QT tool includes the QT Designer, Qt Help and QT interface tools in three parts.


second, QT Basic module Framework

The QT Basic module defines the QT base functionality for all platforms, which is required to use the functionality provided in the module in most QT applications. The bottom of the QT base module is the Qtcore module, and all other modules are dependent on the module, which is why we can always see QT + + Core in the. Pro file. The framework for the entire basic module is shown in the following figure.



At the bottom is Qtcore, which provides all the basic functions of meta-object system, object tree, signal slot, thread, input and output, resource system, container, animation frame, JSON support, state machine framework, plug-in system, event system, etc. The importance of this module is self-evident. Above, directly depends on Qtcore is the qttest, Qtsql, Qtnetwork and Qtgui four modules, wherein the test module qttest and the database module Qtsql is relatively independent, but more important is the network module qtnetwork and graphics module QTG UI, above them two is the important update part of Qt 5 qtqml and QtQuick. The top tier is the newly added Qtmultimedia multimedia module, and the Qtwebkit module on top of it.

For the entire framework, you can understand that the lower module provides support for the upper module, or that the upper module contains the functionality of the lower module. For example, the Qtwebkit module, which has both a graphical interface component and network functionality, supports multimedia applications. For other modules, we are no longer in-depth introduction, the following mainly to explain the most important of the Qtgui module.


Iii. Graphical Interface Library Framework

Now actually qapplication is not in the Qtgui module, in fact, even the base class of all the user interface Qwidget is not in the Qtgui module, they are re-assembled into a new module qtwidgets. A significant change in Qt 5 is the redefinition of the Qtgui module, which is no longer a chatty graphical interface class library, but provides a base class for GUI graphical UI components, including window System integration, event processing, OpenGL and OpenGL ES integration, 2D drawing, basic images, fonts, and text. Content.


The graphics part class in the previous Qtgui module was moved to the Qtwidgets module in QT 5, and the print related classes were moved to the QT Print support module. However, the Qtopengl module was removed from Qt 5, and the OpenGL related classes were moved to the Qtgui module. Some readers may find that the QT extension module still has the Qtopengl module, in fact, it is only to facilitate the QT 4 to QT 5 transplant to retain, in writing QT 5 program is still strongly recommended to use the OpenGL class in the Qtgui module. To understand the general changes in the graphics library, let's look at the overall framework of the Qt GUI library. As shown in the following figure.



Above all supported platforms is the underlying platform abstraction layer QPA, a lighthouse project called Lighthouse, which is the basis for Qt to be ubiquitous. And all the blue blocks on it are the contents of the Qtgui module, they are divided into two categories, a kind of OpenGL as the core, it is now the latest QtQuick2 and Qtwebkit Foundation; class is a generic graphical display class based on auxiliary access and input methods, which are classic Qwidget the base of the part class and the QtQuick1.


Iv. qtqml and QtQuick framework if you want to ask Qt 5 The biggest update and feature is what, that non-qtqml and QtQuick mo genus. In fact, at the time of Qt 4.7 There is already a QtQuick, but it is not mature at that time. Only to the present Qt 5,QML and quick to develop and grow, gradually standardize, and have a share with the Qwidget status. As you may have learned, QML and quick are for mobile devices and are the future direction of Qt development.

QtQuick is defined in QT 4: Qt Quick is an advanced user interface technology that makes it easy to create a dynamic touch interface and lightweight application for mobile and embedded devices. Three new technologies together form the QT Quick user Interface Creation Toolkit: An improved QT Creator IDE, a new easy-to-learn language (QML), and a newly added module called qtdeclarative in the Qt Library, which makes QT more accessible to unfamiliar Used by developers and designers of C + +.

In Qt 5, however, the former QtQuick is divided into two parts: QTQML, which provides a QML language framework, defines and implements the Language Engine Foundation, provides APIs that are easy for developers to use, implements the use of custom types to extend the QML language, and the JavaScript and C + + integration into the QML code. The other part is the new QtQuick, a standard library for writing QML programs that provides all the basic types needed to create a user interface program using QML.

QML and quick have been clearly separated in Qt 5, allowing us to have a clearer understanding of this new technology. This is not so much a new technology, it is a novel language and library of Qt creation, please allow to make a less scientific analogy: QML is like the C + + language, then quick is the QT library, the QT Library is a class library written in C + + language, and quick is to use QML language to compile Write a class library, but in the QML world, there is no class in this term.

The QTQML and QtQuick frameworks are shown in the following diagram:



You can see that qtqml and QtQuick are two separate parts:

QTQML is based on Qtcore, has qtnetwork related functions, and is built on the V8 and V4 two JavaScript engines, V8 should be known, and V4 is a lightweight JavaScript engine. However, it is necessary to mention that in the latest version of QT 5, V8 has been completely replaced by a new QT proprietary engine, because V8 is suitable for browsers but not suitable for QML. We can also see that QTQML itself does not involve the content of graphical display;


The QtQuick is based on QPA, followed by the Qtgui, OpenGL, and Scene graph three layers package, where you can see that the new QtQuick is built on OpenGL and uses a new Scene graph for graphical rendering. Obviously, QtQuick is used for graphical display.


This article transferred from: http://bbs.qter.org

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.