Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.0
-
None
-
Microsoft Visual C++ Compiler 16.7.30413.136
Description
It looks as if when changing the source component of a loader, the target binding of PropertyChanges is destroyed and the target property is not changed anymore.
In the following example, the initial text of the label is "Modified Label". After changing the source component, however, the text binding within the state is no longer applied.
import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 ApplicationWindow { id: root visible: true width: 800 height: 600 ColumnLayout { Loader { id: loader property bool firstLabel: true readonly property Component label1: Label { text: "Label 1" } readonly property Component label2: Label { text: "Label 2" } readonly property Label label: loader.item ?? null sourceComponent: firstLabel ? label1 : label2 StateGroup { states: [ State { when: loader.label !== null PropertyChanges { target: loader.label text: "Modified Label" } } ] } } Switch { onPressed: loader.firstLabel = !loader.firstLabel } } }
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-87463 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
400855,1 | Quick: Document that PropertyChanges ignores changes in target object | dev | qt/qtdeclarative | Status: DEFERRED | 0 | 0 |