QML 术语词汇表

常见术语

术语 定义
QML 编写 QML 应用程序的语言。语言体系结构和引擎由 Qt QML 模块实现。
Qt Quick QML 语言类型和功能的标准库,由 Qt Quick 模块提供,可以访问采用 "import QtQuick 2.3".
类型 在 QML, type 可以引用 基本类型 QML 对象类型 .

QML 语言提供了许多内置 基本类型 ,和 Qt Quick 模块提供各种 Qt Quick 类型 为构建 QML 应用程序。类型也可以由第 3 方开发者提供透过 ( 模块 ) 或由应用程序开发者在应用程序自身透过 QML 文档 .

QML 类型系统 了解更多细节。

基本类型 A 基本类型 is a simple type such as int , string and bool 。不像 object types , an object cannot be instantiated from a basic type; for example, it is not possible to create an int object with properties, methods, signals and so on.

Basic types are built into the QML language, whereas object types cannot be used unless the appropriate 模块 is imported.

QML 类型系统 了解更多细节。

对象类型 A QML 对象类型 is a type that can be instantiated by the QML engine.

A QML type can be defined either by a document in a .qml file beginning with a capital letter, or by a QObject -based C++ class.

QML 类型系统 了解更多细节。

Object QML 对象是实例化的 QML 对象类型 .

Such objects are created by the engine when it processes object declarations , which specify the objects to be created and the attributes that are to be defined for each object.

Additionally, objects can be dynamically created at runtime through Component.createObject() and Qt.createQmlObject().

另请参阅 惰性实例化 .

组件 A component is a template from which a QML object or object tree is created. It is produced when a document is loaded by the QML engine. Once it has been loaded, it can be used to instantiate the object or object tree that it represents.

此外, 组件 type is a special type that can can be used to declare a component inline within a document. Component objects can also be dynamically created through Qt.createComponent() to dynamically create QML objects.

Document A QML Document is a self contained piece of QML source code that begins with one or more import statements and contains a single top-level object declaration. A document may reside in a .qml file or a text string.

If it is placed in a .qml file whose name begins with a capital letter, the file is recognized by the engine as a definition of a QML type. The top-level object declaration encapsulates the object tree that will be instantiated by the type.

特性 A property is an attribute of an object type that has a name and an associated value; this value can be read (and in most cases, also written to) externally.

An object can have one or more properties. Some properties are associated with the canvas (e.g., x, y, width, height, and opacity) while others may be data specific to that type (e.g., the "text" property of the 文本 type).

QML 对象属性 了解更多细节。

Binding A binding is a JavaScript expression which is "bound" to a property. The value of the property at any point in time will be the value returned by evaluating that expression.

特性绑定 了解更多细节。

信号 A signal is a notification from a QML object. When an object emits a signal, other objects can receive and process this signal through a signal handler .

Most properties of QML objects have a change signal, and also an associated change signal handler which may be defined by clients to implement functionality. For example, the "onClicked()" handler of an instance of the MouseArea type might be defined in an application to cause a sound to be played.

信号和处理程序事件系统 了解更多细节。

信号处理程序 A signal handler is the expression (or function) which is triggered by a signal. It is also known as a "slot" in C++.

信号和处理程序事件系统 了解更多细节。

惰性实例化 Object instances can be instantiated "lazily" at run-time, to avoid performing unnecessary work until needed. Qt Quick provides the Loader type to make lazy instantiation more convenient.