Qt QML QML 类型

The Qt Qml module provides the definition and implementation of various convenience types that can be used with the QML language. This includes 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).

要使用模块,import QtQml 模块采用以下语句:

import QtQml
					

很多客户端将从不需要使用 QtQml module directly, but will rather import it indirectly via the QtQuick 模块如下:

import QtQuick
					

Qt Quick module documentation for more information about its types.

The QML types for creating lists and models, such as ListModel and ListElement , belong to a submodule, QtQml.Models .

The WorkerScript QML type belongs to the submodule QtQml.WorkerScript .

Both, QtQml.Models and QtQml.WorkerScript are automatically imported whenever you import QtQml . All their types are then available, too.

The Qt Quick 模块自动导入 QtQml and, transitively, QtQml.Models and QtQml.WorkerScript , making all their types available whenever you import QtQuick .

值类型

下列 QML 值类型 有提供:

point

具有 X 和 Y 属性的值

rect

具有 X、Y、宽度及高度属性的值

size

具有宽度和高度属性的值

序列类型

下列 QML 序列类型 are provided by the Qt QML module in addition to the ones registered with each value type and object type:

  • std::vector<QString>
  • std::vector<QUrl>
  • std::vector<bool>
  • std::vector<int>
  • std::vector<float>
  • std::vector<double>

对象类型

下列 QML 对象类型 有提供:

Binding

使能够创建任意特性绑定

Component

封装 QML 组件定义

Connections

描述信号的一般化连接

Date

提供日期函数

Locale

提供特定区域设置的特性和格式化数据

LoggingCategory

定义 QML 日志类别

Number

提供表示数字值的对象

Qt

提供带有有用 Qt 枚举和函数的全局对象

QtObject

基本 QML 类型

Timer

按指定间隔触发处理程序

XMLHttpRequest

用于向服务器发送请求的对象