diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2021-04-19 13:31:07 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2021-04-20 14:36:59 +0200 |
commit | 67833d929bd8d2ad37565fd0121d70f0b9d13079 (patch) | |
tree | bf898ead4186de4e6245e87d1c33e76742ae4d91 /src/qml/doc/src | |
parent | d54bf8c57a85bf29c0b795e417adb16b7f900cee (diff) |
Document that QML_SINGLETON only works with QObjects
Change-Id: I18c38037cd635fa3300c761b16038b67ac3b0d74
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 03a2e51063de99f85b3b801c7ccd6663163a61b0)
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/doc/src')
-rw-r--r-- | src/qml/doc/src/qmlfunctions.qdoc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc index e66a6aae4a..b9bfafa68d 100644 --- a/src/qml/doc/src/qmlfunctions.qdoc +++ b/src/qml/doc/src/qmlfunctions.qdoc @@ -176,16 +176,17 @@ \relates QQmlEngine Declares the enclosing type to be a singleton in QML. This only takes effect - if the type is available in QML, by having a \l QML_ELEMENT or - \l QML_NAMED_ELEMENT() macro. By default, each QQmlEngine will try to create a - singleton instance using either the type's default constructor or a static - factory function of the signature \c{T *create(QQmlEngine *, QJSEngine *)} - when the type is first accessed. If both do exist and are accessible, the - default constructor is preferred. If there is no default constructor and no - factory function the singleton is initially inaccessible. This behavior can be - overridden by calling \l qmlRegisterSingletonType() with a specific (external) - factory function or \l qmlRegisterSingletonInstance() with a specific instance - for the same class and the same type namespace and version. + if the type is a \l Q_OBJECT and is available in QML (by having a + \l QML_ELEMENT or \l QML_NAMED_ELEMENT() macro). By default, each QQmlEngine + will try to create a singleton instance using either the type's default + constructor or a static factory function of the signature + \c{T *create(QQmlEngine *, QJSEngine *)} when the type is first accessed. If + both do exist and are accessible, the default constructor is preferred. If + there is no default constructor and no factory function the singleton is + initially inaccessible. This behavior can be overridden by calling + \l qmlRegisterSingletonType() with a specific (external) factory function or + \l qmlRegisterSingletonInstance() with a specific instance for the same class + and the same type namespace and version. \sa QML_ELEMENT, QML_NAMED_ELEMENT(), qmlRegisterSingletonInstance(). */ |