Qt QML QML 类型

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 Component object types are non-visual and provide building-blocks for extensions to QML.

导入 QtQml

类型提供通过 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.12, and thus it may be imported via the following statement:

import QtQml 2.12
					

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.12
					

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 有提供:

date 日期值
point 具有 X 和 Y 属性的值
rect 具有 X、Y、宽度及高度属性的值
size 具有宽度和高度属性的值

对象类型

下列 QML 对象类型 有提供:

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