1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the documentation of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:FDL$
9 ** GNU Free Documentation License
10 ** Alternatively, this file may be used under the terms of the GNU Free
11 ** Documentation License version 1.3 as published by the Free Software
12 ** Foundation and appearing in the file included in the packaging of
16 ** Alternatively, this file may be used in accordance with the terms
17 ** and conditions contained in a signed written agreement between you
26 ****************************************************************************/
28 \page qtqml-typereference-topic.html
29 \title QML Types Provided By The Qt QML Module
30 \brief List of QML types provided by the Qt QML module
32 The Qt QML module provides the definition and implementation of the QML
33 language, and it also provides some elementary QML types which provide the
34 basis for further extensions to the QML language.
38 The Qt QML module also provides the \c QtObject and \c Component types which
39 may be used in QML documents, by default. These types are non-visual and
40 provide building-blocks for extensions to QML.
44 \section1 The QtQml Import
46 The types provided by the Qt QML module are only available in a QML document
47 if that document imports the QtQml namespace (or if the document imports the
48 QtQuick namespace, as noted below).
50 The current version of the import provided by the Qt QML module is version 2.0,
51 and thus it may be imported via the following statement:
55 Most clients will never need to use the QtQml import, as all of the types and
56 functionality provided by the QtQml namespace are also provided by the QtQuick
57 namespace which may be imported as follows:
59 \tt{import QtQuick 2.0}
61 See the \l{Qt Quick} module documentation for more information about the
62 QtQuick namespace and what it provides to QML application developers.
64 The documentation for the types below applies equally to the types of the same
65 name provided by the Qt Quick module, as they are in fact identical.
69 The \c QtObject type provides a basic instantiable object which can be used in
70 QML applications. It is non-visual, but may have properties, methods, signals
73 For example, the following QtObject has several properties, one of which has
74 been assigned a \l{Property Binding}
75 {binding}, and a \l{Signal and Handler Event System}{signal handler} for
76 the default change signal which exists for one of its properties:
83 property int b: a + 22
84 property int changeCount: 0
94 The \c Component type provides a basic re-usable component which allows
95 instances of another type to be instantiated on-demand. It may be given an
96 \c id and it has a default property which is the object type to instantiate,
97 but no other properties may be added to it.
99 For example, the following QtObject has two different Component properties,
100 and it uses those components to dynamically construct objects at run-time:
107 property bool which: true
109 property Component a: Component {
112 property int answer: 42
113 function activate() {
114 console.log("The answer is: " + answer);
119 property Component b: Component {
122 property string message: "Hello, World!"
123 function activate() {
124 console.log(message);
129 function activateDynamicObject() {
133 o = a.createObject(null); // no parent
136 o = b.createObject(null); // no parent