diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-07-16 15:59:06 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-16 23:14:39 +0200 |
commit | af4fbcbf901ad0ee48bdd0121769db4dc3c07452 (patch) | |
tree | 92086b47c4072c2046b067a30889268cba12458c /src/qml/doc/src | |
parent | fc56909bbd7444ae6536bed0ddab21f64e0949e7 (diff) |
Document lack of qmlContext/qmlEngine in module API classes
Task-number: QTBUG-23116
Change-Id: Ia6620b4046ac3e72c8b304633fcad40cf0efe2ed
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'src/qml/doc/src')
-rw-r--r-- | src/qml/doc/src/qmlfunctions.qdoc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc index e8f6e5f499..cf3527c7d8 100644 --- a/src/qml/doc/src/qmlfunctions.qdoc +++ b/src/qml/doc/src/qmlfunctions.qdoc @@ -331,4 +331,29 @@ } } \endqml + + Since Module APIs do not have an associated QQmlContext object, then within the functions of a QObject-derived + type that is registered as a module API implementation the QML context and engine information is not available. + The QQmlEngine::contextForObject() function returns NULL when supplied with a pointer to an QObject that + implements a module API. + + Extending the above example: + + \code + class ModuleApiExample : public QObject + { + ... + + Q_INVOKABLE void doSomethingElse() + { + // QML Engine/Context information is not accessible here: + Q_ASSERT(QQmlEngine::contextForObject(this) == 0); + Q_ASSERT(qmlContext(this) == 0); + Q_ASSERT(qmlEngine(this) == 0); + } + + ... + } + \endcode + */ |