diff options
Diffstat (limited to 'doc/src/declarative/qtdeclarative.qdoc')
-rw-r--r-- | doc/src/declarative/qtdeclarative.qdoc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 05dac52..4a6f6a9 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -56,7 +56,7 @@ \macro QML_DECLARE_TYPE() \relates QDeclarativeEngine - Equivalent to \c Q_DECLARE_METATYPE(TYPE) and \c Q_DECLARE_METATYPE(QDeclarativeListProperty<TYPE>) + Equivalent to \c Q_DECLARE_METATYPE(TYPE *) and \c Q_DECLARE_METATYPE(QDeclarativeListProperty<TYPE>) #include <QtDeclarative> to use this macro. */ @@ -85,6 +85,21 @@ Returns the QML type id. + There are two forms of this template function: + + \code + template<typename T> + int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName); + + template<typename T, int metaObjectRevision> + int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName); + \endcode + + The former is the standard form which registers the type \e T as a new type. + The latter allows a particular revision of a class to be registered in + a specified version (see \l {QML Type Versioning}). + + For example, this registers a C++ class \c MySliderItem as a QML type named \c Slider for version 1.0 of a \l{QML Modules}{module} called "com.mycompany.qmlcomponents": @@ -103,7 +118,9 @@ \qml import com.mycompany.qmlcomponents 1.0 - Slider { ... } + Slider { + // ... + } \endqml Note that it's perfectly reasonable for a library to register types to older versions |