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.
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).
To use the module, import the
QtQml
module with the following statement:
import QtQml
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
見
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 Value Types are provided:
| point | 具有 X 和 Y 屬性的值 |
| rect | 具有 X、Y、寬度及高度屬性的值 |
| size | 具有寬度和高度屬性的值 |
下列 QML 對象類型 are provided:
| Binding | 使能夠創建任意特性綁定 |
| Component | 封裝 QML 組件定義 |
| Connections | 描述信號的一般化連接 |
| Date | 提供日期函數 |
| Locale | 提供特定區域設置的特性和格式化數據 |
| LoggingCategory | 定義 QML 日誌類彆 |
| Number | 提供錶示數字值的對象 |
| Qt | 提供帶有有用 Qt 枚舉和函數的全局對象 |
| QtObject | 基本 QML 類型 |
| Timer | 按指定間隔觸發處理程序 |
| XMLHttpRequest | Object for sending requests to a server |