summaryrefslogtreecommitdiffstats
path: root/doc/src/declarative/qtdeclarative.qdoc
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-21 11:29:25 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-21 11:29:25 (GMT)
commit38b8940413fc83d2e641be580369125709ffa8e1 (patch)
tree6612da384fae93e4b31fb8ea7007d3e3934b01d9 /doc/src/declarative/qtdeclarative.qdoc
parentc74dac2a0ef5d1b428c4da4e48fab05f9886233a (diff)
parentedc74eecf2967b295c7b881977527474be8e1c80 (diff)
downloadQt-38b8940413fc83d2e641be580369125709ffa8e1.zip
Qt-38b8940413fc83d2e641be580369125709ffa8e1.tar.gz
Qt-38b8940413fc83d2e641be580369125709ffa8e1.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (118 commits) Update test files to new syntax Compile without Qt3 support. Ensure workerscript.qml works (autotested). Update strings in test remove debugs Make the dynamic creation functions on the Qt object More focus example cleanup. Autotests Add hasModelChildren property to delegates with QAbstractItemModel model type. Emit released and hoveredChanged in MouseArea when a UngrabMouse is received Balance grid items for larger displays. Autotest Cleanup declarative focus example. Add forceFocus method to QDeclarativeItem. Don't allow properties in Component elements Fix crash when QDeclarativeInfo objects are copied Ignore message in QDeclarativeLoader test. Fix crash. Fix qmlvisual/animation/parentAnimation autotest delete the viewer before calling exit(). Ensures correct cleanup. ...
Diffstat (limited to 'doc/src/declarative/qtdeclarative.qdoc')
-rw-r--r--doc/src/declarative/qtdeclarative.qdoc61
1 files changed, 55 insertions, 6 deletions
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index cbb2146..5d1e18f 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -70,9 +70,7 @@
\macro QML_DECLARE_TYPE()
\relates QDeclarativeEngine
- Declares a C++ type to be usable in the QML system. In addition
- to this, a type must also be registered with the QML system using
- qmlRegisterType().
+ Equivalent to Q_DECLARE_METATYPE(TYPE) and Q_DECLARE_METATYPE(QDeclarativeListProperty<TYPE>)
*/
@@ -81,9 +79,8 @@
\relates QDeclarativeEngine
This template function registers the C++ type in the QML system with
- the name \a qmlName. in the library imported from \a uri having the
+ the name \a qmlName, in the library imported from \a uri having the
version number composed from \a versionMajor and \a versionMinor.
- The type should also haved been declared with the QML_DECLARE_TYPE() macro.
Returns the QML type id.
@@ -97,6 +94,59 @@
*/
/*!
+ \fn int qmlRegisterUncreatableType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message)
+ \relates QDeclarativeEngine
+
+ This template function registers the C++ type in the QML system with
+ the name \a qmlName, in the library imported from \a uri having the
+ version number composed from \a versionMajor and \a versionMinor.
+
+ While the type has a name and a type, it cannot be created, and the
+ given error \a message will result if creation is attempted.
+
+ This is useful where the type is only intended for providing attached properties or enum values.
+
+ Returns the QML type id.
+
+ \sa qmlRegisterTypeNotAvailable
+*/
+
+/*!
+ \fn int qmlRegisterTypeNotAvailable(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message)
+ \relates QDeclarativeEngine
+
+ This function registers a type in the QML system with the name \a qmlName, in the library imported from \a uri having the
+ version number composed from \a versionMajor and \a versionMinor, but any attempt to instantiate the type
+ will produce the given error \a message.
+
+ Normally, the types exported by a module should be fixed. However, if a C++ type is not available, you should
+ at least "reserve" the QML type name, and give the user of your module a meaningful error message.
+
+ Returns the QML type id.
+
+ Example:
+
+ \code
+ #ifdef NO_GAMES_ALLOWED
+ qmlRegisterTypeNotAvailable("MinehuntCore", 0, 1, "Game", "Get back to work, slacker!");
+ #else
+ qmlRegisterType<MinehuntGame>("MinehuntCore", 0, 1, "Game");
+ #endif
+ \endcode
+
+ This will cause any QML which uses this module and attempts to use the type to produce an error message:
+ \code
+fun.qml: Get back to work, slacker!
+ Game {
+ ^
+ \endcode
+
+ Without this, a generic "Game is not a type" message would be given.
+
+ \sa qmlRegisterUncreatableType
+*/
+
+/*!
\fn int qmlRegisterType()
\relates QDeclarativeEngine
\overload
@@ -114,7 +164,6 @@
This template function registers the C++ type in the QML system
under the name \a typeName.
- The type should also haved been declared with the QML_DECLARE_TYPE() macro.
Returns the QML type id.