QML 应用程序

QML 是允许就视觉组件、交互、相互关系,描述用户界面的声明性语言。它是旨在使组件能够以动态方式互连,并允许组件在用户界面内被轻松重用和自定义的高度可读语言。使用 QtQuick 模块,设计人员和开发人员可以轻松采用 QML 构建流畅动画用户界面,和拥有把这些用户界面连接到任何后端 c++ 库的选项。

QML 是什么?

QML 是用户界面规范和编程语言。它让开发人员和设计人员同样都能创建高性能、动画流畅、视觉吸引人的应用程序。QML 提供高度可读、声明式、像 JSON 的语法,支持命令式 JavaScript 表达式结合动态特性绑定。

QML 语言和引擎基础设施被提供由 Qt QML 模块。有关 QML 语言的深入信息,请参阅 Qt QML 模块文档编制。

以下页面包含有关 QML 的更多信息:

Qt Quick 是什么?

Qt Quick is the standard library of types and functionality for QML. It includes visual types, interactive types, animations, models and views, particle effects and shader effects. A QML application developer can get access to all of that functionality with a single import statement.

QtQuick QML library is provided by the Qt Quick module. For in-depth information about the various QML types and other functionality provided by Qt Quick, please see the Qt Quick 模块文档编制。

QML 用户界面

For creating or customizing graphical user interfaces, Qt Quick adds visual types, animation types, and other QML types in addition to the standard QML types from Qt QML. Qt Quick Designer is integrated within Qt Creator and supports QtQuick 2 from Qt Creator version 2.7 and onwards.

按钮 菜单及其它控件

For a set of basic UI controls, the Qt Quick Controls module implements several controls such as buttons, menus, and views. These controls come with several built-in styles that can be used, and also support the creation of custom styles.


Several Qt modules provide types for creating special effects in applications. Their respective pages contain more information about specific uses.

在 QML 应用程序中查看 Web 内容

The QML types, WebEngineView and WebView , render and display dynamic web content. The only difference between the two is that the latter uses a native web view if available. Both these types can load a URL or an HTML string. To read more about them and view code samples, see Qt WebEngine and Qt WebView .

传感器 手势和触摸界面

Qt Sensors module allows applications to read information from sensors such as accelerometers and tilt sensors. There is a common QML API for different platforms and can be extended in C++.


Qt Multimedia module enables applications to handle various media content with a convenient set of QML types. These QML types can be extended in C++.


Several Qt modules provide QML APIs for networked and mobile devices. The QML types provide access to the Bluetooth, Near-Field Communications (NFC), and GPS-enabled devices.

更多信息,请拜访 网络和连接 and 移动 API pages.

Code Samples and Demos

To learn more about uses of QML code, there are several code samples which show how QML types are used. In addition, there are several demos which show how QML code is used in applications.


其他 QML 模块

Qt Quick only provides basic visual types and much of Qt's functionality is exposed to QML through other modules. If you require the functionality of those modules, you should browse their QML documentation.

所有 QML API (按模块) 包含 Qt 5 中的所有 QML 模块列表。