Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.8.3, 6.9
-
None
Description
This sample app updates the component periodically whenever the source of MyItem.qml is changed. It works also for more complex hierarchies, changes in sub-components would be also reloaded.
import QtQuick import QtQuick.Controls import Test ApplicationWindow { visible: true Loader { id: loader source: "MyItem.qml" anchors.fill: parent } Timer { repeat: true interval: 300 running: true onTriggered: { const src = loader.source loader.source = "" Qt.callLater(() => { CacheCleaner.clearComponentCache() loader.source = src }) } } }
The call CacheCleaner.clearComponentCache() calls engine->clearComponentCache()
This code always worked fine until Qt 6.8.2.
However, since 6.8.3 it works sometimes, unpredictably, depending on the loaded component or sub-components content.
If MyItem.qml is as follows:
import QtQuick import QtQuick.Controls Button { text: `some text ${this}, ${this instanceof Button}` // when uncommented reloading stops working (Qt 6.8.3 and higher) //font.family: "Tahoma" }
it works fine, but using some specific properties like font.family causes it stops working, the type remains in cache and finally the content is not reloaded.
This ticket is follow up to https://bugreports.qt.io/browse/QTBUG-135448 which was marked as invalid because cache cleanup request was called right after `destoroy` of the component. Here the situation is different, the cleanup is queued via Qt.callLater.