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.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 模型 頁麵有更多信息。

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 對象類型 有提供:

Date 提供日期函數
Number 提供錶示數字值的對象
String 錶示字符串值的對象
Component 封裝 QML 組件定義
Qt 提供帶有有用 Qt 枚舉和函數的全局對象
QtObject 基本 QML 類型
Locale 提供特定區域設置的特性和格式化數據
LoggingCategory 定義 QML 日誌類彆
Binding 使能夠創建任意特性綁定
Connections 描述信號的一般化連接
Instantiator 動態創建對象
Timer 按指定間隔觸發處理程序