Qt Quick

Qt Quick 模块是用于编写 QML 应用程序的标准库。而 Qt QML 模块提供 QML 引擎和语言基础设施,Qt Quick 模块提供采用 QML 创建用户界面的所有必要基本类型。它提供视觉画布,包括用于创建 动画视觉组件、接收用户输入、创建数据模型 视图、及延迟对象实例化的类型。

Qt Quick 模块提供 QML API , which supplies QML types for creating user interfaces with the QML language, and a C++ API 为采用 C++ 代码扩展 QML 应用程序。

注意: 一套基于 Qt Quick 的 UI 控件也可用于创建用户界面。见 Qt Quick Controls 了解更多信息。

If you're new to QML and Qt Quick, please see QML 应用程序 了解编写 QML 应用程序的介绍。

使用模块

QML API

模块的 QML 类型是可用的透过 QtQuick 导入。要使用类型,添加以下 import 语句到 .qml 文件:

import QtQuick
					

C++ API

使用 Qt 模块的 C++ API 要求直接 (或透过其它依赖) 链接到模块库。几个构建工具对此有专用支持,包括 CMake and qmake .

构建采用 CMake

使用 find_package() 命令定位所需模块组件在 Qt6 包:

find_package(Qt6 REQUIRED COMPONENTS Quick)
target_link_libraries(mytarget PRIVATE Qt6::Quick)
					

更多细节,见 构建采用 CMake 概述。

采用 qmake 构建

要配置采用 qmake 构建模块,添加模块作为值为 QT 变量在工程的 .pro 文件:

QT += quick
					

重要 Qt Quick 概念

Qt Quick provides everything you need to create a rich application with a fluid and dynamic user interface. It enables you to build user interfaces around the behavior of user interface components and how they connect with one another, and it provides a visual canvas with its own coordinate system and rendering engine. Animation and transition effects are first class concepts in Qt Quick, and you can add visual effects through specialized components for particle and shader effects.

When using the Qt Quick module, you will need to know how to write QML applications using the QML language. In particular, QML Basics and QML Essentials from the QML 应用程序 页面。

要了解使用 QML 语言的更多有关信息,见 Qt QML 模块文档编制。

C++ 扩展点

文章和指南

范例

参考

许可和归属

Qt Quick 在商业许可下是可用的来自 Qt 公司 。此外,它在自由软件许可下也是可用的。从 Qt 5.4 起,这些自由软件许可是 GNU LGPL (次一般公共许可) 第 3 版 ,或 GNU GPL (一般公共许可) 第 2 版 。见 Qt 许可 进一步了解细节。