The Binding element allows arbitrary property bindings to be created. More...
This element was introduced in Qt 4.7.
Sometimes it is necessary to bind to a property of an object that wasn't directly instantiated by QML - generally a property of a class exported to QML by C++. In these cases, regular property binding doesn't work. Binding allows you to bind any value to any property.
For example, imagine a C++ application that maps an "app.enteredText" property into QML. You could use Binding to update the enteredText property like this.
TextEdit { id: myTextField; text: "Please type here..." } Binding { target: app; property: "enteredText"; value: myTextField.text }
Whenever the text in the TextEdit is updated, the C++ property will be updated also.
If the binding target or binding property is changed, the bound value is immediately pushed onto the new target.
See also QtDeclarative.
property : string |
The property to be updated.
The value to be set on the target object and property. This can be a constant (which isn't very useful), or a bound expression.
when : bool |
This property holds when the binding is active. This should be set to an expression that evaluates to true when you want the binding to be active.
Binding { target: contactName; property: 'text' value: name; when: list.ListView.isCurrentItem }
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.