summaryrefslogtreecommitdiffstats
path: root/doc/src/declarative/qtdeclarative.qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/declarative/qtdeclarative.qdoc')
-rw-r--r--doc/src/declarative/qtdeclarative.qdoc16
1 files changed, 13 insertions, 3 deletions
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index fb50286..413eb59 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -70,13 +70,23 @@
Returns the QML type id.
- Example: Register the C++ class \c MinehuntGame as the QML type
- named \c Game for version 0.1 in the import library \c MinehuntCore:
+ 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":
\code
- qmlRegisterType<MinehuntGame>("MinehuntCore", 0, 1, "Game");
+ qmlRegisterType<MySliderItem>("com.mycompany.qmlcomponents", 1, 0, "Slider");
\endcode
+ Once this is registered, the type can be used in QML by importing the
+ specified module name and version number:
+
+ \qml
+ imoprt com.mycompany.qmlcomponents 1.0
+
+ Slider { ... }
+ \endqml
+
Note that it's perfectly reasonable for a library to register types to older versions
than the actual version of the library. Indeed, it is normal for the new library to allow
QML written to previous versions to continue to work, even if more advanced versions of