Details
-
Task
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
5.15.1
-
None
Description
> Read-only properties must be assigned a value on initialization.
When I use a loader like this:
import QtQuick 2.12 import QtQuick.Window 2.12 Window { width: 640 height: 480 visible: true title: qsTr("Hello World") Component.onCompleted: loader.setSource("qrc:/RectTest.qml", { "text": "asasas"}) Loader { id: loader anchors.fill: parent } } //RectTest.qml import QtQuick 2.0 Rectangle { id:root color: "orange" readonly property string text: "" Text { text:root.text color: "white" anchors.centerIn: parent } }
I would assume that this sets the initial value of the component, like a c++ constructor. Also there is no error message when creating a component like this and trying to set a readonly member.
See attached example