The QML Type System
The types which may be used in the definition of an object hierarchy in a QML document can come from various sources. They may be:
- provided natively by the QML language
- registered via C++ by QML modules
- provided as QML documents by QML modules
Furthermore, application developers can provide their own types, either by registering C++ types directly, or by defining reusable components in QML documents which can then be imported.
Wherever the type definitions come from, the engine will enforce type-safety for properties and instances of those types.
The QML language has built-in support for various primitive types including integers, double-precision floating point numbers, strings, and boolean values. Objects may have properties of these types, and values of these types may be passed as arguments to methods of objects.
See the QML Basic Types documentation for more information about basic types.
For example, the standard
Array types are available, as below:
A QML object type is a type from which a QML object can be instantiated. QML object types are derived from QtObject, and are provided by QML modules. Applications can import these modules to use the object types they provide. The
QtQuick module provides the most common object types needed to create user interfaces in QML.
Finally, every QML document implicitly defines a QML object type, which can be re-used in other QML documents. See the documentation about object types in the QML type system for in-depth information about object types.
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.