Define-time property
-
Hi guys,
I want to create following type of QtQuick item:
@MyItem {
id: myItem
name: "test"
value: 100
}@name and value should only be write-able at define-time. So when the Object is created on loading the QML file and initializator of the Object is called I can use name and value with the corresponding values. The properties should never be changed at runtime.
Is there a way to this in QML? The only thing which came to my mind is to use the Component.onCompleted() function and to call a pseudo-initializator but that's not a very clean way I suppose. A behavior like the id has would be great.
-
Okay I have found: http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-definetypes.html#receiving-notifications-for-object-initialization
This might probably work.