Qt QML QML Types

The Qt QML module provides the definition and implementation of various convenience types which can be used with the QML language, including some elementary QML types which can provide the basis for further extensions to the QML language. The QtObject and 组件 object types are non-visual and provide building-blocks for extensions to QML.

Importing QtQml

The types provided by the QtQml module are only available in a QML document if that document imports the QtQml namespace (or if the document imports the QtQuick namespace, as noted below).

当前版本的 QtQml module is version 2.2, and thus it may be imported via the following statement:

import QtQml 2.2
					

Most clients will never need to use the QtQml import, as all of the types are also provided by the QtQuick namespace which may be imported as follows:

import QtQuick 2.7
					

Qt Quick module documentation for more information about the QtQuick namespace and what it provides to QML application developers.

The QML types for creating lists and models, such as ListModel and ListElement , are moved to a submodule, QtQml.Models Qt QML Models 页面有更多信息。

The documentation for the types below applies equally to the types of the same name provided by the Qt Quick module, as they are in fact identical.

基本类型

下列 QML basic types are provided:

date 日期值
point Value with x and y attributes
rect Value with x, y, width and height attributes
size Value with width and height attributes

对象类型

下列 QML 对象类型 are provided:

Date 提供日期函数
Number 提供表示数字值的对象
字符串 表示字符串值的对象
组件 封装 QML 组件定义
Qt 提供带有有用 Qt 枚举和函数的全局对象
QtObject 基本 QML 类型
区域设置 提供特定区域设置的特性和格式化数据
LoggingCategory 定义 QML 日志类别
Binding 使能够创建任意特性绑定
Connections 描述信号的一般化连接
Instantiator 动态创建对象
Timer 按指定间隔触发处理程序