Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
Qt fo MCUs 2.5.2
Description
Let's assume that in code snippet below Flickable.visibleArea.xPosition should be readonly:
pragma main;
Image {
id: root
Flickable {
id: flickable
}
Timer {
interval: 200
running: true
onTriggered: flickable.visibleArea.xPosition = 5;
}
}
In regular Qt / QML we get a following kind of error at runtime (which in case of Qt for MCUs should be a suitable compile error):
...ListView.qml:35: TypeError: Cannot assign to read-only property "xPosition"
Current workaround for exposing readonly proprties from C++ (for example in case of temperature measurement) is to implement a signal handler tempMeter.setPointer(temperature) which arguably is not very QMLish thing to do.
As suggestion:
It should be possible to specify properties as "readonly" from C++ maybe by having Qul::Property<int, Qul::ReadOnly> property extension or by implementing Qul::ReadOnlyProperty<T>.