Introduction to the Qt 5 framework and qt5 framework

Source: Internet
Author: User
Tags qt designer

Introduction to the Qt 5 framework and qt5 framework

This article was originally published in The Qter open-source community (www.qter.org) by yafeilinux. For more information, see the source!


1. view all modules in help

Open Qt Creator, go to its help mode, select the directory mode for viewing, and open the "Qt 5.2.0ReferenceDocumentation" page. Here we provide an overall introduction to Qt 5.2 and classify all its contents. Select "All Qt Modules" in the lower right corner to view All Qt Modules. As shown in.



On the page of all modules, the Qt module is divided into three parts: Qt essential, Qt Add-Ons, and Qt Tools ).



The basic Qt module contains the basic functions of Qt, which will be explained in detail later;


The Qt extension module contains some mobile-related modules in QtMobility, such as Bluetooth qtblustmth and QtSensors. It also contains some previous Qt 4 modules, such as QtDBus, QtXML, and QtScript. In addition, some new modules are added, such as QtGraphicalEffects, Serial Qt Serial Port, and Qt3D in the commercial version. These modules have special purposes, and many of them must be available on special platforms. In the extension module, we also see the Qt Print Support module, which is a reorganization module of many classes in the past;


The Qt tool contains three parts: Qt designer, Qt help, and Qt interface tool.


Ii. Basic Qt module framework

The Qt Basic module defines the basic functions of Qt for all platforms. In most Qt applications, you need to use the functions provided by this module. The underlying layer of the Qt Basic module is the QtCore module, and all other modules depend on this module. This is why we can always see QT + = core in the. pro file. Shows the framework of the entire basic module.



The bottom layer is QtCore, it provides the metadata system, Object Tree, signal slot, thread, input and output, resource system, container, animation framework, JSON support, state machine framework, plug-in system, event system, and so on. function. The importance of this module is self-evident. Based on QtCore, QtTest, QtSql, QtNetwork, and QtGui modules are directly dependent. The test module QtTest and the database module QtSql are relatively independent, more importantly, the Network Module QtNetwork and the graphic module QtGui are the important updates of Qt 5, QtQml and QtQuick. The top layer is the newly added QtMultiMedia multimedia module and the QtWebKit module above it.

For the entire framework, you can understand that the lower-layer modules provide support for the upper-layer modules, or that the upper-layer modules include the lower-layer modules. For example, the QtWebKit module supports both graphical interface components and network functions and multimedia applications. For other modules, we will not go into details here. The following describes the most important QtGui module.


Iii. graphic interface library framework

In fact, QApplication is not included in the QtGui module. In fact, even the basic qwidgets of all user interfaces are not included in the QtGui module. They are combined into a new QtWidgets module. A major change to Qt 5 is to redefine the QtGui module. It is no longer a large and complete graphical interface class library, but provides a base class for GUI components, including window system integration, event processing, OpenGL and OpenGL ES integration, 2D drawing, basic image, font and text.


In Qt 5, move the graphical component class in the previous QtGui module to the QtWidgets module, and move the printing class to the Qt Print Support module. However, the QtOpenGL module is removed from Qt 5, and the OpenGL class is moved to the QtGui module. Some readers may find that the QtOpenGL module still exists in the Qt extension module. In fact, it is reserved only for the convenience of porting Qt 4 to Qt 5, we strongly recommend that you use the OpenGL class in the QtGui module when compiling the Qt 5 program. After learning about the general changes to the graphics library, let's take a look at the overall framework of the Qt graphic interface library. As shown in.



On a variety of supported platforms, it is the underlying abstraction layer QPA. This is a beacon project called LightHouse. It is the foundation that Qt can be everywhere. All the blue blocks on them are the content of the QtGui module. They are divided into two categories. OpenGL is the core and is the basis of the latest QtQuick2 and QtWebkit; the first class is a general graphics display class based on the auxiliary access and input mode. They are the basis of the classic QWidget component class and QtQuick1.


IV. If the QtQml and QtQuick frameworks need to ask what is the biggest update and feature of Qt 5, they are not QtQml and QtQuick. In fact, QtQuick was already available in Qt 4.7, but it was not mature at that time. Only Qt 5, qml, and quick have grown and become more standardized, and have the same position as QWidget. As you may have learned, qml and quick are born for mobile devices and will be the development direction of Qt in the future.

QtQuick is defined in Qt 4 as follows: Qt Quick is an advanced user interface technology, it allows you to easily create dynamic touch interfaces and lightweight applications for mobile and embedded devices. Three new technologies constitute the Qt Quick user interface creation Toolkit: An Improved Qt Creator IDE and a new easy-to-learn language (QML) and a new module named QtDeclarative In the Qt library, which makes Qt easier for developers and designers who are not familiar with C ++.

However, in Qt 5, the previous QtQuick is divided into two parts: QtQml, which provides a QML language framework that defines and implements the language engine basics, it also provides APIs that are easy for developers to use to extend the QML language using custom types and integrate JavaScript and C ++ into QML code. Another part is the new QtQuick, which is a standard library for compiling QML programs. It provides all the basic types required to use QML to create user interface programs.

Qml and quick have been clearly separated in Qt 5, so that we can have a clearer understanding of this new technology. This is not so much a new technology as it is a new language and class library created by Qt. Please allow an unscientific example here: qml is like a C ++ language, in this case, quick is the Qt library, and Qt is a class library written in C ++, while quick is a class library written in qml, but in the qml world, there is no such name.

Shows the QtQml and QtQuick frameworks:



We can see that QtQml and QtQuick are independent parts:

Based on QtCore and having relevant functions of QtNetwork, QtQml is built on two JavaScript Engines V8 and V4, which should be well known by V8 and V4 is a lightweight JavaScript Engine. However, in the latest Qt 5 version, V8 has been completely replaced by a new Qt proprietary engine because V8 is applicable to browsers but not qml. We can also see that QtQml itself does not involve graphic display content;


Based on QPA, QtQuick is encapsulated by QtGui, OpenGL, and Scene graph. We can see that the new QtQuick is built on OpenGL, the new Scene graph is used for graphic rendering. Obviously, QtQuick is used for graphic display.


This article

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.