From af15183ca230cb96ef9e2901e3fbb716eb4300bb Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 21 Aug 2009 10:07:17 +1000 Subject: Renaming: Bind -> Binding --- demos/declarative/contacts/contacts.qml | 8 ++++---- doc/src/declarative/binding.qdoc | 14 +++++++------- doc/src/declarative/elements.qdoc | 2 +- .../contacts/3_Collections/3/ContactView.qml | 8 ++++---- src/declarative/util/qmlbind.cpp | 20 ++++++++++---------- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/demos/declarative/contacts/contacts.qml b/demos/declarative/contacts/contacts.qml index 8410ac1..0082ecf 100644 --- a/demos/declarative/contacts/contacts.qml +++ b/demos/declarative/contacts/contacts.qml @@ -71,22 +71,22 @@ Rectangle { id: Details anchors.fill: wrapper opacity: 0 - Bind { + Binding { target: Details.item property: "contactId" value: model.recid } - Bind { + Binding { target: Details.item property: "label" value: model.label } - Bind { + Binding { target: Details.item property: "phone" value: model.phone } - Bind { + Binding { target: Details.item property: "email" value: model.email diff --git a/doc/src/declarative/binding.qdoc b/doc/src/declarative/binding.qdoc index a649f3f..064f686 100644 --- a/doc/src/declarative/binding.qdoc +++ b/doc/src/declarative/binding.qdoc @@ -5,17 +5,17 @@ Data binding provides a declarative way of specifying the data associated with objects, as well as the relationship between data of different objects. For example, you could bind the text of a label to the value of a slider: as the value of the slider changed, the label would be automatically updated with the new value. -Bindings are created in QML when an expression is assigned to a property. For example, the following produces two rectangles of equal size (\c rect2 is bound to the size of \c rect1): +Bindings are created in QML when an expression is assigned to a property. For example, the following produces two rectangles of equal size (\c Rect2 is bound to the size of \c Rect1): \code -Rectangle { id: rect1; width: 100; height: 100 } -Rectangle { id: rect2; width: rect1.width; height: rect1.height } +Rectangle { id: Rect1; width: 100; height: 100 } +Rectangle { id: Rect2; width: Rect1.width; height: Rect1.height } \endcode -There is also a special \l Bind element, which is typically used to bind from the UI to the underlying UI model (see \l {Passing Data Between C++ and QML} for an example of this). The bindings above could be expressed using the \l Bind element as: +There is also a special \l Binding element, which is typically used to bind from the UI to the underlying UI model (see \l {Passing Data Between C++ and QML} for an example of this). The bindings above could be expressed using the \l Binding element as: \code -Bind { target: rect2; property: "width"; value: rect1.width } -Bind { target: rect2; property: "height"; value: rect1.height } +Binding { target: Rect2; property: "width"; value: Rect1.width } +Binding { target: Rect2; property: "height"; value: Rect1.height } \endcode In addition to binding directly to a property, you can also bind to the results of expressions involving properties. For example: @@ -102,7 +102,7 @@ Finally, in QML you can make the appropriate bindings, so in \c "MyUI.qml": \code Slider { value: screen.brightness } -Bind { target: screen; property: "brightness"; value: slider.value } +Binding { target: screen; property: "brightness"; value: slider.value } \endcode The \l QBindableMap class provides a convenient way to make data visible to the bind engine. diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 2d43fda..aef05d7 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -40,7 +40,7 @@ The following table lists the QML elements provided by the Qt Declarative module \o \list -\o \l Bind +\o \l Binding \o \l ListModel \o \l VisualItemModel \o \l XmlListModel and XmlRole diff --git a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml index cc115e3..eac43c7 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml @@ -66,22 +66,22 @@ Item { opacity: 0 //! [setting qml] //! [binding] - Bind { + Binding { target: Details.item property: "contactId" value: model.recid } - Bind { + Binding { target: Details.item property: "label" value: model.label } - Bind { + Binding { target: Details.item property: "phone" value: model.phone } - Bind { + Binding { target: Details.item property: "email" value: model.email diff --git a/src/declarative/util/qmlbind.cpp b/src/declarative/util/qmlbind.cpp index f3b5fa4..d18ef47 100644 --- a/src/declarative/util/qmlbind.cpp +++ b/src/declarative/util/qmlbind.cpp @@ -63,27 +63,27 @@ public: QmlNullableValue value; }; -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Bind,QmlBind) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Binding,QmlBind) /*! - \qmlclass Bind QmlBind - \brief The Bind element allows arbitrary property bindings to be created. + \qmlclass Binding QmlBind + \brief The Binding element allows arbitrary property bindings to be created. 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. Bind + 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 Bind to update the enteredText property + property into QML. You could use Binding to update the enteredText property like this. \code TextEdit { id: myTextField; text: "Please type here..." } - Bind { target: app; property: "enteredText"; value: myTextField.text /> + Binding { target: app; property: "enteredText"; value: myTextField.text } \endcode Whenever the text in the TextEdit is updated, the C++ property will be updated also. - If the bind target or bind property is changed, the bound value is + If the binding target or binding property is changed, the bound value is immediately pushed onto the new target. \sa {qmlforcpp}{Qt Declarative Markup Language For C++ Programmers} @@ -123,7 +123,7 @@ void QmlBind::setWhen(bool v) } /*! - \qmlproperty Object Bind::target + \qmlproperty Object Binding::target The object to be updated. */ @@ -141,7 +141,7 @@ void QmlBind::setObject(QObject *obj) } /*! - \qmlproperty string Bind::property + \qmlproperty string Binding::property The property to be updated. */ @@ -159,7 +159,7 @@ void QmlBind::setProperty(const QString &p) } /*! - \qmlproperty any Bind::value + \qmlproperty any Binding::value 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. -- cgit v0.12 From 5d1aeb0ac86d373920f03d0e4c96a5e315b0eb12 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 21 Aug 2009 10:09:22 +1000 Subject: update QmlChanges.txt --- src/declarative/QmlChanges.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index b95faf3..3ef81f4 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -16,6 +16,7 @@ Rect -> Rectangle FocusRealm -> FocusScope FontFamily -> FontLoader Palette -> SystemPalette +Bind -> Binding Renamed properties: MouseRegion: xmin -> minimumX @@ -49,7 +50,6 @@ Pending Changes Renamed elements: RunScriptAction -> ScriptAction ParentChangeAction -> ParentAction -Bind -> Binding SetProperties -> PropertyChanges RunScript -> StateChangeScript SetAnchors -> AnchorChanges -- cgit v0.12