Qt framework and module understanding

Xiaobai has been in touch with Qt since his work, and has been using Qt5.3.1 version, so he has not experienced the troubles of big cows moving projects from Qt4 programs to Qt5, and maybe they will encounter them in the future. I am amazed at all the rich APIs of Qt, and I have a very vague understanding of Qt's framework and modules. There is something wrong in the text. I hope that the big cows will slap their faces (although their faces have been swollen...)
1. Qt Cross-platform (Linux, Unix, Mac OS, Android, IOS) in
short: Qt's functionality is built on top of the platform's underlying APIs it supports.
write picture description here

  • Qt/Windows corresponds to GDI (Graphics Device Interface), and it is easy to know that it is the API that Qt encapsulates to communicate with GDI. GDI is the main API for graphics drawing and display under Windows.
  • Qt/X11 is also a programming interface to X Windows. Linux itself does not have an operation interface. At present, the mainstream Linux systems with an operation interface are based on X WIndows, which has been included in the standard software of Linux distribution. X Windows is a C/S framework (that is, all mouse events are passed to the X Windows server for processing and corresponding to the content displayed on the screen), and Qt/X11 uses Xlib to communicate directly with the X server. (GDI is integrated into the Windows kernel, and X Windows is just the application software of the Linux system)
  • Not to mention Qt/Macintosh. Carbon is an application development environment under Mac OS X that includes the graphics part of the application. The current mainstream Cocoa seems to be better to use.
    The above figure mainly illustrates the UI part, and Qt calls the local graphics style across platforms.

    The three operating systems all support mainstream file systems (the file system is not inherent to the operating system, the file system describes the way in which files are stored and searched in the hard disk), and the communication adopts the socket framework (socket is a product of the network era, at that time operating system is very mature). At this point, you can roughly understand the basic principles of Qt cross-platform.

Qt Framework

Searching for All modules in Qt help can clearly see the module distribution of Qt.

  1. Qt Essentials (basic modules of Qt) here refers to stable modules that developers will often use.
  2. 2. Qt Add-Ons (extension module) There are many modules in the extension module for the mobile terminal, such as Qt Bluetooth, Qt Positioning, and Qt Sensors. Commonly used in UI are Qt Graphical Effects, Qt Image Formats, Qt SVG. The easy-to-use Qt Print Support and Qt Serial Port of the newly added PC hardware resources originally supported Camera, Screen, and Audio Device in the multimedia module. Qt XML Xiaobai uses less tables and seems to be very useful in data processing. Xiaobai likes Qt Quick Widgets very much, because the UI that Xiaobai wrote last year is basically based on QWidget, and it is very convenient to extend the Qml interface. For Qt Canva 3D (only available in 5.5) that wants to develop 3D on Qt, this is easier than getting started with OPENGL.
  3. There are also some Value-Add, Technology Preview, Tool modules that do not affect the understanding of the framework.
    Basic module structure diagram
    Qt5 basic module structure diagram
    Xiaobai only lists the commonly used module structure divisions here. For details, you need to refer to the help documentation.
    In the Qt Widgets module, it is explained here that QGraphics Scene and QWidget are two different UI systems of Qt (the former is based on OpenGL and the latter is based on the original drawing mechanism), and the source of development is different. For details, please see this blog drawing . The architecture of the device and Graphics View Framework
    graphical interface library.
    Interface library architecture
    This diagram contains parts of Qt GUI and Qt Widget. The blue blocks represent the components included in the GUI module. You can refer to the functional description of the Qt GUI module in the above figure, and It does not contain all the display parts. If you want to know more about it, you can refer to the help documentation.
    From here, you can also see more intuitively how the two different UI systems are structured. It should be noted that Qt Quick1 is designed from the QPainter system. Below we will explain the architecture of Qt Quick1 and Qt Quick2.
    Qt Qml and Qt Quick framework
    QML: (Qt Meta-Object Language) emphasizes that this is a language that describes the declarative language of the application, what grammar rules are, and there are many scripting languages ​​that are descriptive.
    Qt Qml: It is a framework for QML application development and standard library, and provides an interface that allows developers to extend the QML language with custom types and inheritance of Javascript and C++ code. Xiaobai's understanding is that the modules we need for mixed programming of QML, Javascript, C++, and Html are provided here. It is developed based on the Qt-specific engine (QML interpreter).
    Qt Quick: Qml Module This book does not involve display, all graphics processing is done by the Quick module. After three layers of packaging: Qt GUI, OpenGL, and Scene Graph. The emphasis is on how to draw graphics efficiently and create various effects as required. So it includes visualization types (QML), interaction types, animations, model views, particle effects, rendering effects, etc.
    To distinguish these three concepts, let's take a look at the difference between Quick1 and Quick2.
    write picture description here
    Here it is clear why Quick1 can only do some deformation and rotation without more powerful special effects, because QPainter really can't do that, Daniel can of course directly use QOpenGL to do special effects directly under Qt4.

    The basic framework of Qt is only a conceptual introduction here. You can view the help document during the reading process, and learn about the basic introduction of specific modules and the classes involved in the modules. The main reference here is "Introduction to Qt5 Programming". It will continue to be repaired in the future. . .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325448643&siteId=291194637