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
A way to explicitly tell that you don't want a binding is to call an assignment in an expression block:
Rectangle {
property int one: 1
property int two: {two = 2 * one}
}
Unlike the approach of breaking the binding in onCompleted, the expression block avoids the creation and then destruction of a binding object, and it looks cleaner.