Add double property as alias to text property
-
Hi! I defined my own component, FloatField that is essentially a TextField with DoubleValidator. I want to implement a value property that should be equal to text property converted to double. I implemented updating value as text changed. But how can I update text then user changed value?
TextField { property double value: 0 validator: DoubleValidator { } focus: true text: "0" onAccepted: value = text }
-
The asnwer turns out to be as simple as:
TextField { property double value: 0 validator: DoubleValidator { } focus: true text: "0" onAccepted: value = text onValueChanged: text = value }