Relationship and summary of script, quick, and qml of QT

Source: Internet
Author: User

Recently I have been learning qml, and it is not difficult to understand that the sequence of things that have been exposed to QT is script, quick1, declarative, quick2, and qml. So what does each of them do? I am confused about these things, so I decided to clarify them first for better learning.


First, let's look at their history.

Qtscript is introduced from QT 4.3.
Qt quick1 is introduced from QT 4.7.
Qt quick1 contains the QT declarative module and qml.
Qt quick1.1 is introduced from QT 4.8.
Qt quick2 is introduced from QT 5.

Qtscript Introduction

Qtscript is a script language based on ecmascript. For details about ecmascript, see w3school: ecmascript.

In the script, you can access the instances of the qobject type and its subclass in the original C ++ code, connect signals and slots, and create instances of the qobject type and its subclass.

However, qtscript cannot be run independently. It must be used with C ++ code to implement complete functions.

Similar to qtplugins, you can also create Plugins in qtscript. Qtplugins Provide extensions for C ++ development, while qtscript plugins Provide extensions for script development.

The typical application that can be thought of is: you can write a scriptplugin so that you can use qsettings in the script, then everything is convenient, and you do not need to rewrite the source code of QIF.

In QT 5, the QT script and QT script tool modules are removed from the list of modules. Although they are still stored in QT 5, their importance is reduced a lot.
From the installation directory of QT 5, QT script and QT script tool are still provided in the form of independent DLL, but we can find that the code of the two projects has not changed much through source code comparison, only some refactoring work can be seen from the header file of the API directory. Apart from removing the qt_module macro, there are almost no changes.

Qt quick1 Introduction

Qt quick1 is a collection used to create interactive interfaces on various mobile devices. The purpose of the design is to allow the UI designers and developers to work more closely.

It contains user interface elements, a language used to describe the interactive interface (qml), and a qml Language Runtime (QT declarative module)

Qml complies with the Javascript syntax in terms of syntax and extends the required QT.

W3school: Javascript

W3school: HTTP & CSS

The QT declarative module provides a dynamic framework to build a dynamic interactive interface and provide a runtime environment for qml. It solves the interaction between C ++ and qml.

Qt quick2 Introduction

Qt quick2 provides five QT modules as the framework for qml program development, including QT qml, QT quick, QT quick controls, QT quick dialogs, and QT quick layouts. Compared with QT 4.8, a module is the most intuitive change.

Qml programs are provided starting with QT 5. This makes the qml program no longer have to start from the C ++ code, but can be run as an independent script.


Currently, it is in the QT 5 era, but based on the previous experience of QT 3, QT 4 will continue to exist for a long time.
In QT 5, qtscript is downgraded; the declarative module is replaced by two qml modules; in addition to supporting the old qml script, quick1 has almost no use; quick2 and qml will be paid more and more attention in future QT versions. In QT 5, quick2 has added many interesting features and needs to be further studied.

Is there any relationship between qtscript and qml?
First, the two are not directly related. They are all scripts.
Qtscript complies with ecmascript standards
Qml is a self-defined Syntax of QT, similar to JSON
Qml is designed to write an interactive interface using dynamic languages.
Qtscript is designed to make the Dynamic Language business logic part. It can also be part of the interface-Level Logic.

By writing this article, I finally clarified the relationships among qtscript, qml, quick1, quick2, and declarative. I hope you will understand the 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: 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.