Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.12.10, 5.15.2, 6.0, 6.1.0 Alpha, 6.1, 6.2
-
-
dd86881520dde6c1487e5397f10b82584e6b9eaa (qt/qtdeclarative/dev) aea1336f9e7be7e85d2286b2a388341fda6b61ae (qt/qtdeclarative/6.2)
Description
When building a QML project using Qt Quick compiler, if an AnchorChanges is applied when the component is loading, it just does not appear at all.
import QtQuick 2.12 ApplicationWindow { width: 1280 height: 720 Rectangle { id: rectangle width: parent.width * 0.2 height: parent.height anchors.right: parent.right color: "red" state: "closed" states: [ State { name: "closed" AnchorChanges { target: rectangle; anchors.right: undefined; anchors.left: parent.right } } ] } MouseArea { anchors.fill: parent onClicked: rectangle.state = (rectangle.state == "closed" ? "" : "closed") } }
In this example, the Rectangle is by default attached to the right of the screen, and a click hides it. Applying the "closed" state to the rectangle at loading prevents it to be displayed.
It works fine without the QtQuick compiler, and it works fine when removing the "state: "closed"" line.
Attachments
Issue Links
- relates to
-
QTBUG-101364 qmllint spurious error: QML State AnchorChanges: with type QQuickAnchorLine to QQmlScriptString of QQmlScriptString
-
- Closed
-
For Gerrit Dashboard: QTBUG-91165 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
361960,7 | QQmlIRBuilder: Always preserve "undefined" string | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
363777,2 | QQmlIRBuilder: Always preserve "undefined" string | 6.2 | qt/qtdeclarative | Status: MERGED | +2 | 0 |