Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.15.2, 6.0, 6.1, 6.2
-
Desktop Windows 10 VS2019 Qt 5.15.2
-
-
547f5761cb31600c9669ba205512fa0b6c7d36da (qt/qtdeclarative/dev)
Description
My test code:
import QtQuick 2.15 import QtQuick.Window 2.15 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") component MyCircle: Rectangle{ id: rootMyCircle; property alias name: txtName.text property int age: 18 height: 100; width: height; radius: height/2; anchors.centerIn: parent; color: "black"; Component.onCompleted: console.log("Radius:",rootMyCircle.radius); Column { anchors.centerIn: parent Text { id: txtName; color: "white"; text: "Foo" } Text { id: txtAge; color: "white"; text: age } } } MyCircle{ // When either something or name is commented out: it works property string something: "" name: "Bar" age: 21 radius: 5 } }
Compiling and running with Qt 5.15.2 windows produces error in runtime:
qrc:/main.qml:26:9: Cannot assign to non-existent property "name"
- When the line with: property something is commented out it works
- When the line with: name: "Bar" is commented out it works
So my conclusion is:
Inner components with alias properties stop working when you define a new property in an instantiation of that inner component. Normal properties work perfectly fine though. Alias properties work fine as long as you don't define any new properties in an instantiation.
Attachments
Issue Links
- duplicates
-
QTBUG-91991 Engine cannot resolve property aliases in nested inline components
- Closed
- relates to
-
QTBUG-85980 QQmlPropertyValueSource does not work with aliased properties of inline components
- Closed
For Gerrit Dashboard: QTBUG-91143 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
341752,6 | Resolve inline components before root component | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |