diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-08-19 12:49:43 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-08-20 15:56:19 +0200 |
commit | ae33c2da3ec33c2280167c0202aab6cd5d168b82 (patch) | |
tree | ac5cff7714df28d773c205aa67d80d07647185cc /src/qml/qml/qqmlengine.cpp | |
parent | 0a3273d85b76ff60654465c1d0df91b5d610b0d1 (diff) |
Document that clearComponentCache() does not clear existing objects
Task-number: QTBUG-95788
Pick-to: 5.15 6.2
Change-Id: I547ec38676d7e6f9b25fea79f58b94eacb135a5f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index db0a1a3ef3..13950b6356 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -853,6 +853,16 @@ QQmlEngine::~QQmlEngine() Once the component cache has been cleared, components must be loaded before any new objects can be created. + \note Any existing objects created from QML components retain their types, + even if you clear the component cache. This includes singleton objects. If you + create more objects from the same QML code after clearing the cache, the new + objects will be of different types than the old ones. Assigning such a new + object to a property of its declared type belonging to an object created + before clearing the cache won't work. + + As a general rule of thumb, make sure that no objects created from QML + components are alive when you clear the component cache. + \sa trimComponentCache() */ void QQmlEngine::clearComponentCache() |