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

用於嚮服務器發送請求的對象