I want to create a custom QML component with two properties one
and two
, which should have default values when left uninitialized. In particular, i
In fact, you just shouldn't. Binding is the base behaviour of QML, if you try to avoid it, then that's because you're not thinking the good way.
For exemple, if property two initial value is calculated with property one initial value but not property one value,
Then that mean you want to bind on Initial value not value, you should create a readonly property which value will be property one initial value :
readonly property int initialOne : 1;
property int one : initialOne;
property int two : 2 * initialOne;
It could seem a little heavy, but if you think about it, the initial value is what you wanna use, and so, the concept of the property is what you really want