summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/declarative/contacts/Button.qml5
-rw-r--r--demos/declarative/contacts/ContactField.qml10
-rw-r--r--demos/declarative/contacts/FieldText.qml45
-rw-r--r--demos/declarative/contacts/RemoveButton.qml25
-rw-r--r--demos/declarative/contacts/contacts.qml45
-rw-r--r--demos/declarative/flickr/content/ImageDetails.qml2
-rw-r--r--demos/declarative/flickr/content/MediaLineEdit.qml5
-rw-r--r--demos/declarative/flickr/flickr2.qml10
-rw-r--r--demos/declarative/webbrowser/webbrowser.qml84
-rw-r--r--doc/src/declarative/animation.qdoc10
-rw-r--r--doc/src/declarative/elements.qdoc1
-rw-r--r--doc/src/declarative/tutorial3.qdoc24
-rw-r--r--examples/declarative/listview/highlight.qml4
-rw-r--r--examples/declarative/listview/recipes.qml13
-rw-r--r--examples/declarative/minehunt/minehunt.qml6
-rw-r--r--examples/declarative/scrollbar/display.qml12
-rw-r--r--examples/declarative/slideswitch/Switch.qml8
-rw-r--r--examples/declarative/states/states.qml6
-rw-r--r--examples/declarative/states/transitions.qml6
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml25
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml25
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml25
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml25
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml25
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml25
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml25
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml10
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml35
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml25
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml10
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml35
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml25
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml26
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml26
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml5
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml10
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml35
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml26
-rw-r--r--examples/declarative/tutorials/helloworld/t3/tutorial3.qml12
-rw-r--r--examples/declarative/xmldata/yahoonews.qml12
-rw-r--r--src/declarative/qml/qmlbindablevalue.cpp35
-rw-r--r--src/declarative/qml/qmlbindablevalue.h10
-rw-r--r--src/declarative/qml/qmlbindablevalue_p.h6
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp47
-rw-r--r--src/declarative/qml/qmlmetaproperty.h4
-rw-r--r--src/declarative/qml/qmlvme.cpp4
-rw-r--r--src/declarative/util/qmlanimation.cpp6
-rw-r--r--src/declarative/util/qmlsetproperties.cpp28
-rw-r--r--src/declarative/util/qmlsetproperties.h4
-rw-r--r--src/declarative/util/qmlstate.cpp84
-rw-r--r--src/declarative/util/qmlstate.h13
-rw-r--r--src/declarative/util/qmlstate_p.h8
-rw-r--r--src/declarative/util/qmlstateoperations.cpp10
-rw-r--r--tests/auto/declarative/visual/bindinganimation/bindinganimation.qml10
-rw-r--r--tests/auto/declarative/visual/colorAnimation/colorAnimation.qml10
-rw-r--r--tests/auto/declarative/visual/easing/easing.qml10
56 files changed, 485 insertions, 592 deletions
diff --git a/demos/declarative/contacts/Button.qml b/demos/declarative/contacts/Button.qml
index 3b76a13..5623b26 100644
--- a/demos/declarative/contacts/Button.qml
+++ b/demos/declarative/contacts/Button.qml
@@ -24,10 +24,9 @@ Item {
State {
name: "pressed"
when: buttonMouseRegion.pressed == true
- SetProperty {
+ SetProperties {
target: buttonRect
- property: "color"
- value: "green"
+ color: "green"
}
}
]
diff --git a/demos/declarative/contacts/ContactField.qml b/demos/declarative/contacts/ContactField.qml
index 003e723..60a4cc5 100644
--- a/demos/declarative/contacts/ContactField.qml
+++ b/demos/declarative/contacts/ContactField.qml
@@ -34,15 +34,13 @@ Item {
State {
name: "editingText"
when: fieldText.state == 'editing'
- SetProperty {
+ SetProperties {
target: removeButton.anchors
- property: "rightMargin"
- value: -35
+ rightMargin: -35
}
- SetProperty {
+ SetProperties {
target: fieldText
- property: "width"
- value: contactField.width
+ width: contactField.width
}
}
]
diff --git a/demos/declarative/contacts/FieldText.qml b/demos/declarative/contacts/FieldText.qml
index 39e45d4..ae84d44 100644
--- a/demos/declarative/contacts/FieldText.qml
+++ b/demos/declarative/contacts/FieldText.qml
@@ -96,50 +96,41 @@ Rect {
states: [
State {
name: "editing"
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: fieldText
- property: "color"
- value: "white"
+ color: "white"
}
- SetProperty {
+ SetProperties {
target: textEdit
- property: "color"
- value: "black"
+ color: "black"
}
- SetProperty {
+ SetProperties {
target: textEdit
- property: "readOnly"
- value: false
+ readOnly: false
}
- SetProperty {
+ SetProperties {
target: textEdit
- property: "focus"
- value: true
+ focus: true
}
- SetProperty {
+ SetProperties {
target: editRegion
- property: "opacity"
- value: 0
+ opacity: 0
}
- SetProperty {
+ SetProperties {
target: textEdit.anchors
- property: "leftMargin"
- value: 34
+ leftMargin: 34
}
- SetProperty {
+ SetProperties {
target: textEdit.anchors
- property: "rightMargin"
- value: 34
+ rightMargin: 34
}
}
]
diff --git a/demos/declarative/contacts/RemoveButton.qml b/demos/declarative/contacts/RemoveButton.qml
index 8f46fcb..c1cc816 100644
--- a/demos/declarative/contacts/RemoveButton.qml
+++ b/demos/declarative/contacts/RemoveButton.qml
@@ -85,30 +85,25 @@ Rect {
states: [
State {
name: "opened"
- SetProperty {
+ SetProperties {
target: removeButton
- property: "width"
- value: removeButton.expandedWidth
+ width: removeButton.expandedWidth
}
- SetProperty {
+ SetProperties {
target: text
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: trashIcon
- property: "opacity"
- value: 0
+ opacity: 0
}
}
]
diff --git a/demos/declarative/contacts/contacts.qml b/demos/declarative/contacts/contacts.qml
index 0ce9948..fd49041 100644
--- a/demos/declarative/contacts/contacts.qml
+++ b/demos/declarative/contacts/contacts.qml
@@ -50,10 +50,9 @@ Rect {
State {
name: "currentItem"
when: wrapper.ListView.isCurrentItem
- SetProperty {
+ SetProperties {
target: label
- property: "color"
- value: "black"
+ color: "black"
}
}
]
@@ -94,30 +93,25 @@ Rect {
states: [
State {
name: "opened"
- SetProperty {
+ SetProperties {
target: wrapper
- property: "height"
- value: contactListView.height
+ height: contactListView.height
}
- SetProperty {
+ SetProperties {
target: contactListView
- property: "yPosition"
- value: wrapper.y
+ yPosition: wrapper.y
}
- SetProperty {
+ SetProperties {
target: contactListView
- property: "locked"
- value: 1
+ locked: 1
}
- SetProperty {
+ SetProperties {
target: label
- property: "opacity"
- value: 0
+ opacity: 0
}
- SetProperty {
+ SetProperties {
target: Details
- property: "opacity"
- value: 1
+ opacity: 1
}
}
]
@@ -277,10 +271,9 @@ Rect {
State {
name: "searchHidden"
when: searchBar.text == '' || contacts.mode != 'list'
- SetProperty {
+ SetProperties {
target: searchBarWrapper.anchors
- property: "bottomMargin"
- value: -30
+ bottomMargin: -30
}
}
]
@@ -303,15 +296,13 @@ Rect {
State {
name: "editNewState"
when: contacts.mode == 'new'
- SetProperty {
+ SetProperties {
target: contactListView
- property: "opacity"
- value: 0
+ opacity: 0
}
- SetProperty {
+ SetProperties {
target: newContactWrapper
- property: "opacity"
- value: 1
+ opacity: 1
}
}
]
diff --git a/demos/declarative/flickr/content/ImageDetails.qml b/demos/declarative/flickr/content/ImageDetails.qml
index ccc91cb..d17e323 100644
--- a/demos/declarative/flickr/content/ImageDetails.qml
+++ b/demos/declarative/flickr/content/ImageDetails.qml
@@ -129,7 +129,7 @@ Flipable {
states: [
State {
name: "Back"
- SetProperty { target: Container; property: "rotation"; value: 180 }
+ SetProperties { target: Container; rotation: 180 }
}
]
diff --git a/demos/declarative/flickr/content/MediaLineEdit.qml b/demos/declarative/flickr/content/MediaLineEdit.qml
index 691bb5b..65c2b38 100644
--- a/demos/declarative/flickr/content/MediaLineEdit.qml
+++ b/demos/declarative/flickr/content/MediaLineEdit.qml
@@ -14,10 +14,9 @@ Item {
target: Label
text: Container.label + ": "
}
- SetProperty {
+ SetProperties {
target: Label
- property: "x"
- binding: 10
+ x: 10
}
SetProperties {
target: Editor
diff --git a/demos/declarative/flickr/flickr2.qml b/demos/declarative/flickr/flickr2.qml
index 79f7a32..2f4c823 100644
--- a/demos/declarative/flickr/flickr2.qml
+++ b/demos/declarative/flickr/flickr2.qml
@@ -48,7 +48,6 @@ Item {
Script {
function photoClicked() {
Background.imageDetails.photoTitle = title;
- Background.imageDetails.flickableArea.yPosition = 0;
Background.imageDetails.photoDescription = description;
Background.imageDetails.photoTags = tags;
Background.imageDetails.photoWidth = photoWidth;
@@ -129,15 +128,12 @@ Item {
states: [
State {
name: "gridView"
- SetProperty { target: Wrapper; property: "moveToParent"; value: GridViewPackage }
+ SetProperties { target: Wrapper; explicit: true; property: "moveToParent"; value: GridViewPackage }
},
State {
name: "pathView"
- SetProperty { target: Wrapper; property: "scale"; value: PathViewPackage.PathView.scale }
- SetProperty { target: Wrapper; property: "scale"; binding: "PathViewPackage.PathView.scale" }
- SetProperty { target: Wrapper; property: "angle"; value: PathViewPackage.PathView.angle }
- SetProperty { target: Wrapper; property: "angle"; binding: "PathViewPackage.PathView.angle" }
- SetProperty { target: Wrapper; property: "moveToParent"; value: PathViewPackage }
+ SetProperties { target: Wrapper; scale: PathViewPackage.PathView.scale; angle: PathViewPackage.PathView.angle; }
+ SetProperties { target: Wrapper; explicit: true; moveToParent: PathViewPackage }
}
]
transitions: [
diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml
index 889ab87..3dcc20d 100644
--- a/demos/declarative/webbrowser/webbrowser.qml
+++ b/demos/declarative/webbrowser/webbrowser.qml
@@ -151,20 +151,12 @@ Item {
State {
name: "Normal"
when: WebView.progress == 1.0
- SetProperty {
- target: Header
- property: "progressOff"
- value: 1
- }
+ SetProperties { target: Header; progressOff: 1 }
},
State {
name: "ProgressShown"
when: WebView.progress < 1.0
- SetProperty {
- target: Header
- property: "progressOff"
- value: 0
- }
+ SetProperties { target: Header; progressOff: 0; }
}
]
transitions: [
@@ -255,30 +247,14 @@ Item {
State {
name: "Enabled"
when: WebView.back.enabled==true
- SetProperty {
- target: back_e
- property: "opacity"
- value: 1
- }
- SetProperty {
- target: back_d
- property: "opacity"
- value: 0
- }
+ SetProperties { target: back_e; opacity: 1 }
+ SetProperties { target: back_d; opacity: 0 }
},
State {
name: "Disabled"
when: WebView.back.enabled==false
- SetProperty {
- target: back_e
- property: "opacity"
- value: 0
- }
- SetProperty {
- target: back_d
- property: "opacity"
- value: 1
- }
+ SetProperties { target: back_e; opacity: 0 }
+ SetProperties { target: back_d; opacity: 1 }
}
]
transitions: [
@@ -327,30 +303,14 @@ Item {
State {
name: "Enabled"
when: WebView.forward.enabled==true
- SetProperty {
- target: forward_e
- property: "opacity"
- value: 1
- }
- SetProperty {
- target: forward_d
- property: "opacity"
- value: 0
- }
+ SetProperties { target: forward_e; opacity: 1 }
+ SetProperties { target: forward_d; opacity: 0 }
},
State {
name: "Disabled"
when: WebView.forward.enabled==false
- SetProperty {
- target: forward_e
- property: "opacity"
- value: 0
- }
- SetProperty {
- target: forward_d
- property: "opacity"
- value: 1
- }
+ SetProperties { target: forward_e; opacity: 0 }
+ SetProperties { target: forward_d; opacity: 1 }
}
]
transitions: [
@@ -372,29 +332,13 @@ Item {
states: [
State {
name: "Normal"
- SetProperty {
- target: WebView
- property: "zoomedOut"
- value: 0
- }
- SetProperty {
- target: Flick
- property: "xPosition"
- value: Math.min(WebView.width-Flick.width,Math.max(0,Flick.centerX-Flick.width/2))
- }
- SetProperty {
- target: Flick
- property: "yPosition"
- value: Math.min(WebView.height-Flick.height,Math.max(0,Flick.centerY-Flick.height/2))
- }
+ SetProperties { target: WebView; zoomedOut: 0 }
+ SetProperties { target: Flick; explicit: true; xPosition: Math.min(WebView.width-Flick.width,Math.max(0,Flick.centerX-Flick.width/2)) }
+ SetProperties { target: Flick; explicit: true; yPosition: Math.min(WebView.height-Flick.height,Math.max(0,Flick.centerY-Flick.height/2)) }
},
State {
name: "ZoomedOut"
- SetProperty {
- target: WebView
- property: "zoomedOut"
- value: 1
- }
+ SetProperties { target: WebView; zoomedOut: 1 }
}
]
transitions: [
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc
index f17f5c9..9edb54d 100644
--- a/doc/src/declarative/animation.qdoc
+++ b/doc/src/declarative/animation.qdoc
@@ -89,15 +89,13 @@ Item {
states: [
State {
name: "moved"
- SetProperty {
+ SetProperties {
target: myrect
- property: "x"
- value: 50
+ x: 50
}
- SetProperty {
+ SetProperties {
target: myrect
- property: "y"
- value: 50
+ y: 50
}
}
]
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index 35d746b..d078da0 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -18,7 +18,6 @@ The following table lists the Qml elements provided by the Qt Declarative module
\o
\list
\o \l State
-\o \l SetProperty
\o \l SetProperties
\o \l ParentChange
\o \l RunScript
diff --git a/doc/src/declarative/tutorial3.qdoc b/doc/src/declarative/tutorial3.qdoc
index 0b97e63..e52e353 100644
--- a/doc/src/declarative/tutorial3.qdoc
+++ b/doc/src/declarative/tutorial3.qdoc
@@ -28,16 +28,8 @@ Rect {
State {
name: "down"
when: MouseRegion.pressed == true
- SetProperty {
- target: HelloText
- property: "y"
- value: 160
- }
- SetProperty {
- target: HelloText
- property: "color"
- value: "red"
- }
+ SetProperties { target: HelloText; y: 160 }
+ SetProperties { target: HelloText color: "red" }
}
]
transitions: [
@@ -80,16 +72,8 @@ states: [
State {
name: "down"
when: MouseRegion.pressed == true
- SetProperty {
- target: HelloText
- property: "y"
- value: 160
- }
- SetProperty {
- target: HelloText
- property: "color"
- value: "red"
- }
+ SetProperties { target: HelloText; y: 160 }
+ SetProperties { target: HelloText; color: "red" }
}
]
\endcode
diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml
index 9a672d9..b9d56b2 100644
--- a/examples/declarative/listview/highlight.qml
+++ b/examples/declarative/listview/highlight.qml
@@ -23,9 +23,7 @@ Rect {
State {
name: "Current"
when: Wrapper.ListView.isCurrentItem
- SetProperty {
- target: Wrapper; property: "x"; value: 10
- }
+ SetProperties { target: Wrapper; x: 10 }
}
]
transitions: [
diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml
index ae9756c..829f074 100644
--- a/examples/declarative/listview/recipes.qml
+++ b/examples/declarative/listview/recipes.qml
@@ -14,7 +14,7 @@ Rect {
width: List.width
// Create a property to contain the visibility of the details.
// We can bind multiple element's opacity to this one property,
- // rather than having a "SetProperty" line for each element we
+ // rather than having a "SetProperties" line for each element we
// want to fade.
property real detailsOpacity : 0
@@ -94,20 +94,17 @@ Rect {
states: [
State {
name: "Details"
- SetProperty { target: background; property: "color"; value: "white" }
+ SetProperties { target: background; color: "white" }
// Make the picture bigger
SetProperties { target: recipePic; width: 128; height: 128 }
// Make details visible
SetProperties { target: wrapper; detailsOpacity: 1; x: 0 }
// Make the detailed view fill the entire list area
- SetProperty { target: wrapper; property: "height"; value: List.height }
+ SetProperties { target: wrapper; height: List.height }
// Move the list so that this item is at the top.
- SetProperty {
- target: wrapper.ListView.view
- property: "yPosition"; value: wrapper.y
- }
+ SetProperties { target: wrapper.ListView.view; explicit: true; yPosition: wrapper.y }
// Disallow flicking while we're in detailed view
- SetProperty { target: wrapper.ListView.view; property: "locked"; value: 1 }
+ SetProperties { target: wrapper.ListView.view; locked: 1 }
}
]
transitions: [
diff --git a/examples/declarative/minehunt/minehunt.qml b/examples/declarative/minehunt/minehunt.qml
index db826a3..df8660f 100644
--- a/examples/declarative/minehunt/minehunt.qml
+++ b/examples/declarative/minehunt/minehunt.qml
@@ -64,11 +64,7 @@ Item {
State {
name: "back"
when: modelData.flipped == true
- SetProperty {
- target: flipable
- property: "rotation"
- value: 180
- }
+ SetProperties { target: flipable; rotation: 180 }
}
]
transitions: [
diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml
index 42e8f25..bf40d2d 100644
--- a/examples/declarative/scrollbar/display.qml
+++ b/examples/declarative/scrollbar/display.qml
@@ -16,16 +16,8 @@ Rect {
State {
name: "ShowBars"
when: View.moving
- SetProperty {
- target: SBV
- property: "opacity"
- value: 1
- }
- SetProperty {
- target: SBH
- property: "opacity"
- value: 1
- }
+ SetProperties { target: SBV; opacity: 1 }
+ SetProperties { target: SBH; opacity: 1 }
}
]
transitions: [
diff --git a/examples/declarative/slideswitch/Switch.qml b/examples/declarative/slideswitch/Switch.qml
index 8bc88e4..cd93ec9 100644
--- a/examples/declarative/slideswitch/Switch.qml
+++ b/examples/declarative/slideswitch/Switch.qml
@@ -39,13 +39,13 @@ Item {
states: [
State {
name: "On"
- SetProperty { target: Knob; property: "x"; value: 78 }
- SetProperty { target: Switch; property: "on"; value: true }
+ SetProperties { target: Knob; x: 78 }
+ SetProperties { target: Switch; on: true }
},
State {
name: "Off"
- SetProperty { target: Knob; property: "x"; value: 1 }
- SetProperty { target: Switch; property: "on"; value: false }
+ SetProperties { target: Knob; x: 1 }
+ SetProperties { target: Switch; on: false }
}
]
transitions: [
diff --git a/examples/declarative/states/states.qml b/examples/declarative/states/states.qml
index bcde20c..6bd9813 100644
--- a/examples/declarative/states/states.qml
+++ b/examples/declarative/states/states.qml
@@ -26,15 +26,15 @@ Rect {
// In state 'Position1', change the 'myrect' item x, y to 150, 50.
State {
name: "Position1"
- SetProperty { target: myrect; property: "x"; value: 150 }
- SetProperty { target: myrect; property: "y"; value: 50 }
+ SetProperties { target: myrect; x: 150 }
+ SetProperties { target: myrect; y: 50 }
},
// In state 'Position2', change y to 100. We do not specify 'x' here -
// it will therefore be restored to its default value of 0, if it
// had been changed.
State {
name: "Position2"
- SetProperty { target: myrect; property: "y"; value: 200 }
+ SetProperties { target: myrect; y: 200 }
}
]
}
diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml
index 4c1dceb..d01fea8 100644
--- a/examples/declarative/states/transitions.qml
+++ b/examples/declarative/states/transitions.qml
@@ -26,15 +26,15 @@ Rect {
// In state 'Position1', change the 'myrect' item x, y to 150, 50.
State {
name: "Position1"
- SetProperty { target: myrect; property: "x"; value: 150 }
- SetProperty { target: myrect; property: "y"; value: 50 }
+ SetProperties { target: myrect; x: 150; }
+ SetProperties { target: myrect; y: 50; }
},
// In state 'Position2', change y to 100. We do not specify 'x' here -
// it will therefore be restored to its default value of 0, if it
// had been changed.
State {
name: "Position2"
- SetProperty { target: myrect; property: "y"; value: 200 }
+ SetProperties { target: myrect; y: 200 }
}
]
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml
index a359aaf..135a519 100644
--- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml
+++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml
@@ -79,30 +79,25 @@ Rect {
states: [
State {
name: "opened"
- SetProperty {
+ SetProperties {
target: removeButton
- property: "width"
- value: 230
+ width: 230
}
- SetProperty {
+ SetProperties {
target: text
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: trashIcon
- property: "opacity"
- value: 0
+ opacity: 0
}
}
]
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml
index 4db49ea..5ee56ce 100644
--- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml
+++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml
@@ -86,30 +86,25 @@ Rect {
states: [
State {
name: "opened"
- SetProperty {
+ SetProperties {
target: removeButton
- property: "width"
- value: 230
+ width: 230
}
- SetProperty {
+ SetProperties {
target: text
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: trashIcon
- property: "opacity"
- value: 0
+ opacity: 0
}
}
]
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml
index 29d464b..00dec9e 100644
--- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml
+++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml
@@ -74,30 +74,25 @@ Rect {
states: [
State {
name: "opened"
- SetProperty {
+ SetProperties {
target: removeButton
- property: "width"
- value: 230
+ width: 230
}
- SetProperty {
+ SetProperties {
target: text
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: trashIcon
- property: "opacity"
- value: 0
+ opacity: 0
}
}
]
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml
index 3142c45..3a9f318 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml
@@ -74,30 +74,25 @@ Rect {
states: [
State {
name: "opened"
- SetProperty {
+ SetProperties {
target: removeButton
- property: "width"
- value: 230
+ width: 230
}
- SetProperty {
+ SetProperties {
target: text
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: trashIcon
- property: "opacity"
- value: 0
+ opacity: 0
}
}
]
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml
index 3142c45..3a9f318 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml
@@ -74,30 +74,25 @@ Rect {
states: [
State {
name: "opened"
- SetProperty {
+ SetProperties {
target: removeButton
- property: "width"
- value: 230
+ width: 230
}
- SetProperty {
+ SetProperties {
target: text
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: trashIcon
- property: "opacity"
- value: 0
+ opacity: 0
}
}
]
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml
index bf6e82d..362591e 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml
@@ -76,30 +76,25 @@ Rect {
states: [
State {
name: "opened"
- SetProperty {
+ SetProperties {
target: removeButton
- property: "width"
- value: 230
+ width: 230
}
- SetProperty {
+ SetProperties {
target: text
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: trashIcon
- property: "opacity"
- value: 0
+ opacity: 0
}
}
]
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml
index 99a521d..5595414 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml
@@ -81,31 +81,26 @@ Rect {
State {
name: "opened"
//! [use width]
- SetProperty {
+ SetProperties {
target: removeButton
- property: "width"
- value: removeButton.expandedWidth
+ width: removeButton.expandedWidth
}
//! [use width]
- SetProperty {
+ SetProperties {
target: text
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: trashIcon
- property: "opacity"
- value: 0
+ opacity: 0
}
}
]
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml
index 890d781..8ae4d7d 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml
@@ -34,15 +34,13 @@ Item {
State {
name: "editingText"
when: fieldText.state == 'editing'
- SetProperty {
+ SetProperties {
target: removeButton.anchors
- property: "rightMargin"
- value: -35
+ rightMargin: -35
}
- SetProperty {
+ SetProperties {
target: fieldText
- property: "width"
- value: contactField.width
+ width: contactField.width
}
}
]
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml
index 8bf5317..b55aab8 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml
@@ -94,40 +94,33 @@ Rect {
states: [
State {
name: "editing"
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: textEdit
- property: "readOnly"
- value: false
+ readOnly: false
}
- SetProperty {
+ SetProperties {
target: textEdit
- property: "focus"
- value: true
+ focus: true
}
- SetProperty {
+ SetProperties {
target: editRegion
- property: "opacity"
- value: 0
+ opacity: 0
}
- SetProperty {
+ SetProperties {
target: textEdit.anchors
- property: "leftMargin"
- value: 39
+ leftMargin: 39
}
- SetProperty {
+ SetProperties {
target: textEdit.anchors
- property: "rightMargin"
- value: 39
+ rightMargin: 39
}
}
]
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml
index 2f27a69..6b4cd99 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml
@@ -77,30 +77,25 @@ Rect {
states: [
State {
name: "opened"
- SetProperty {
+ SetProperties {
target: removeButton
- property: "width"
- value: removeButton.expandedWidth
+ width: removeButton.expandedWidth
}
- SetProperty {
+ SetProperties {
target: text
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: trashIcon
- property: "opacity"
- value: 0
+ opacity: 0
}
}
]
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml
index e9927e9..06a959d 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml
@@ -32,15 +32,13 @@ Item {
State {
name: "editingText"
when: fieldText.state == 'editing'
- SetProperty {
+ SetProperties {
target: removeButton.anchors
- property: "rightMargin"
- value: -35
+ rightMargin: -35
}
- SetProperty {
+ SetProperties {
target: fieldText
- property: "width"
- value: contactField.width
+ width: contactField.width
}
}
]
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml
index d4fbc20..1a5b77b 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml
@@ -95,40 +95,33 @@ Rect {
states: [
State {
name: "editing"
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: textEdit
- property: "readOnly"
- value: false
+ readOnly: false
}
- SetProperty {
+ SetProperties {
target: textEdit
- property: "focus"
- value: true
+ focus: true
}
- SetProperty {
+ SetProperties {
target: editRegion
- property: "opacity"
- value: 0
+ opacity: 0
}
- SetProperty {
+ SetProperties {
target: textEdit.anchors
- property: "leftMargin"
- value: 39
+ leftMargin: 39
}
- SetProperty {
+ SetProperties {
target: textEdit.anchors
- property: "rightMargin"
- value: 39
+ rightMargin: 39
}
}
]
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml
index bfe496e..4398ac1 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml
@@ -82,30 +82,25 @@ Rect {
states: [
State {
name: "opened"
- SetProperty {
+ SetProperties {
target: removeButton
- property: "width"
- value: removeButton.expandedWidth
+ width: removeButton.expandedWidth
}
- SetProperty {
+ SetProperties {
target: text
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: trashIcon
- property: "opacity"
- value: 0
+ opacity: 0
}
}
]
diff --git a/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml
index 0a293f5..1be4b99 100644
--- a/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml
+++ b/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml
@@ -71,30 +71,26 @@ Item {
states: [
State {
name: "opened"
- SetProperty {
+ SetProperties {
target: wrapper
- property: "height"
- value: contactListView.height
+ height: contactListView.height
}
- SetProperty {
+ SetProperties {
target: contactListView
- property: "yPosition"
- value: wrapper.y
+ explicit: true
+ yPosition: wrapper.y
}
- SetProperty {
+ SetProperties {
target: contactListView
- property: "locked"
- value: 1
+ locked: 1
}
- SetProperty {
+ SetProperties {
target: label
- property: "opacity"
- value: 0
+ opacity: 0
}
- SetProperty {
+ SetProperties {
target: Details
- property: "opacity"
- value: 1
+ opacity: 1
}
}
]
diff --git a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml
index 7a44a3f..a3b3e18 100644
--- a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml
+++ b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml
@@ -89,30 +89,26 @@ Item {
states: [
State {
name: "opened"
- SetProperty {
+ SetProperties {
target: wrapper
- property: "height"
- value: contactListView.height
+ height: contactListView.height
}
- SetProperty {
+ SetProperties {
target: contactListView
- property: "yPosition"
- value: wrapper.y
+ explicit: true
+ yPosition: wrapper.y
}
- SetProperty {
+ SetProperties {
target: contactListView
- property: "locked"
- value: 1
+ locked: 1
}
- SetProperty {
+ SetProperties {
target: label
- property: "opacity"
- value: 0
+ opacity: 0
}
- SetProperty {
+ SetProperties {
target: Details
- property: "opacity"
- value: 1
+ opacity: 1
}
}
]
diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml
index 3b76a13..5623b26 100644
--- a/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml
+++ b/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml
@@ -24,10 +24,9 @@ Item {
State {
name: "pressed"
when: buttonMouseRegion.pressed == true
- SetProperty {
+ SetProperties {
target: buttonRect
- property: "color"
- value: "green"
+ color: "green"
}
}
]
diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml
index e9927e9..06a959d 100644
--- a/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml
+++ b/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml
@@ -32,15 +32,13 @@ Item {
State {
name: "editingText"
when: fieldText.state == 'editing'
- SetProperty {
+ SetProperties {
target: removeButton.anchors
- property: "rightMargin"
- value: -35
+ rightMargin: -35
}
- SetProperty {
+ SetProperties {
target: fieldText
- property: "width"
- value: contactField.width
+ width: contactField.width
}
}
]
diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml
index 111d9c5..b4dc559 100644
--- a/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml
+++ b/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml
@@ -95,40 +95,33 @@ Rect {
states: [
State {
name: "editing"
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: textEdit
- property: "readOnly"
- value: false
+ readOnly: false
}
- SetProperty {
+ SetProperties {
target: textEdit
- property: "focus"
- value: true
+ focus: true
}
- SetProperty {
+ SetProperties {
target: editRegion
- property: "opacity"
- value: 0
+ opacity: 0
}
- SetProperty {
+ SetProperties {
target: textEdit.anchors
- property: "leftMargin"
- value: 39
+ leftMargin: 39
}
- SetProperty {
+ SetProperties {
target: textEdit.anchors
- property: "rightMargin"
- value: 39
+ rightMargin: 39
}
}
]
diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml
index c0ea79d..95ca062 100644
--- a/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml
+++ b/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml
@@ -80,30 +80,26 @@ Rect {
states: [
State {
name: "opened"
- SetProperty {
+ SetProperties {
target: removeButton
- property: "width"
- value: removeButton.expandedWidth
+ explicit: true
+ width: removeButton.expandedWidth
}
- SetProperty {
+ SetProperties {
target: text
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: confirmIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: cancelIcon
- property: "opacity"
- value: 1
+ opacity: 1
}
- SetProperty {
+ SetProperties {
target: trashIcon
- property: "opacity"
- value: 0
+ opacity: 0
}
}
]
diff --git a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
index bd89ecf..e0515ec 100644
--- a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
+++ b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
@@ -14,16 +14,8 @@ Rect {
State {
name: "down"
when: MouseRegion.pressed == true
- SetProperty {
- target: HelloText
- property: "y"
- value: 160
- }
- SetProperty {
- target: HelloText
- property: "color"
- value: "red"
- }
+ SetProperties { target: HelloText; y: 160 }
+ SetProperties { target: HelloText; color: "red" }
}
]
transitions: [
diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml
index b465ef1..a5bb2f1 100644
--- a/examples/declarative/xmldata/yahoonews.qml
+++ b/examples/declarative/xmldata/yahoonews.qml
@@ -64,16 +64,8 @@ Rect {
states: [
State {
name: "Details"
- SetProperty {
- target: Wrapper
- property: "height"
- binding: "contents.height + 10"
- }
- SetProperty {
- target: Description
- property: "opacity"
- value: 1
- }
+ SetProperties { target: Wrapper; height: contents.height + 10 }
+ SetProperties { target: Description; opacity: 1 }
}
]
transitions: [
diff --git a/src/declarative/qml/qmlbindablevalue.cpp b/src/declarative/qml/qmlbindablevalue.cpp
index d1835cf..222ea87 100644
--- a/src/declarative/qml/qmlbindablevalue.cpp
+++ b/src/declarative/qml/qmlbindablevalue.cpp
@@ -53,18 +53,18 @@ QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(scriptWarnings, QML_SCRIPT_WARNINGS);
QmlBindableValuePrivate::QmlBindableValuePrivate()
-: inited(false), updating(false), mePtr(0)
+: inited(false), updating(false), enabled(true), mePtr(0)
{
}
QML_DEFINE_NOCREATE_TYPE(QmlBindableValue);
-QmlBindableValue::QmlBindableValue(void *data, QmlRefCount *rc, QObject *obj, QObject *parent)
-: QmlPropertyValueSource(*new QmlBindableValuePrivate, parent), QmlExpression(QmlContext::activeContext(), data, rc, obj)
+QmlBindableValue::QmlBindableValue(void *data, QmlRefCount *rc, QObject *obj, QmlContext *ctxt, QObject *parent)
+: QmlPropertyValueSource(*new QmlBindableValuePrivate, parent), QmlExpression(ctxt, data, rc, obj)
{
}
-QmlBindableValue::QmlBindableValue(const QString &str, QObject *obj, QObject *parent)
-: QmlPropertyValueSource(*new QmlBindableValuePrivate, parent), QmlExpression(QmlContext::activeContext(), str, obj)
+QmlBindableValue::QmlBindableValue(const QString &str, QObject *obj, QmlContext *ctxt, QObject *parent)
+: QmlPropertyValueSource(*new QmlBindableValuePrivate, parent), QmlExpression(ctxt, str, obj)
{
}
@@ -105,6 +105,15 @@ void QmlBindableValue::setExpression(const QString &expr)
update();
}
+void QmlBindableValue::forceUpdate()
+{
+ Q_D(QmlBindableValue);
+ if (!d->inited)
+ init();
+ else
+ update();
+}
+
Q_DECLARE_METATYPE(QList<QObject *>);
void QmlBindableValue::update()
{
@@ -113,7 +122,7 @@ void QmlBindableValue::update()
#ifdef Q_ENABLE_PERFORMANCE_LOG
QFxPerfTimer<QFxPerf::BindableValueUpdate> bu;
#endif
- if (!d->inited)
+ if (!d->inited || !d->enabled)
return;
if (!d->updating) {
@@ -159,4 +168,18 @@ void QmlBindableValue::valueChanged()
update();
}
+void QmlBindableValue::setEnabled(bool e)
+{
+ Q_D(QmlBindableValue);
+ d->enabled = e;
+ setTrackChange(e);
+}
+
+bool QmlBindableValue::enabled() const
+{
+ Q_D(const QmlBindableValue);
+
+ return d->enabled;
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlbindablevalue.h b/src/declarative/qml/qmlbindablevalue.h
index f54481a..50bbf36 100644
--- a/src/declarative/qml/qmlbindablevalue.h
+++ b/src/declarative/qml/qmlbindablevalue.h
@@ -62,8 +62,8 @@ class Q_DECLARATIVE_EXPORT QmlBindableValue : public QmlPropertyValueSource,
{
Q_OBJECT
public:
- QmlBindableValue(const QString &, QObject *, QObject *parent=0);
- QmlBindableValue(void *, QmlRefCount *, QObject *, QObject *parent);
+ QmlBindableValue(const QString &, QObject *, QmlContext *, QObject *parent=0);
+ QmlBindableValue(void *, QmlRefCount *, QObject *, QmlContext *, QObject *parent);
~QmlBindableValue();
virtual void setTarget(const QmlMetaProperty &);
@@ -74,8 +74,12 @@ public:
virtual void setExpression(const QString &);
void init();
+ void forceUpdate();
-private Q_SLOTS:
+ void setEnabled(bool);
+ bool enabled() const;
+
+public Q_SLOTS:
void update();
protected:
diff --git a/src/declarative/qml/qmlbindablevalue_p.h b/src/declarative/qml/qmlbindablevalue_p.h
index 9476b80..b55a314 100644
--- a/src/declarative/qml/qmlbindablevalue_p.h
+++ b/src/declarative/qml/qmlbindablevalue_p.h
@@ -54,8 +54,10 @@ class QmlBindableValuePrivate : public QObjectPrivate
public:
QmlBindableValuePrivate();
- bool inited;
- bool updating;
+ bool inited:1;
+ bool updating:1;
+ bool enabled:1;
+
QmlMetaProperty property;
QmlBindableValue **mePtr;
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index 52036c2..30e818b 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -519,7 +519,7 @@ QMetaProperty QmlMetaProperty::property() const
Returns the binding associated with this property, or 0 if no binding
exists.
*/
-QmlBindableValue *QmlMetaProperty::binding()
+QmlBindableValue *QmlMetaProperty::binding() const
{
if (!isProperty() || type() & Attached)
return 0;
@@ -537,6 +537,51 @@ QmlBindableValue *QmlMetaProperty::binding()
return 0;
}
+/*!
+ Set the binding associated with this property to \a binding. Returns
+ the existing binding (if any), otherwise 0.
+
+ \a binding will be enabled, and the returned binding (if any) will be
+ disabled.
+*/
+QmlBindableValue *QmlMetaProperty::setBinding(QmlBindableValue *binding) const
+{
+ if (!isProperty() || type() & Attached)
+ return 0;
+
+ const QObjectList &children = object()->children();
+ for (QObjectList::ConstIterator iter = children.begin();
+ iter != children.end(); ++iter) {
+ QObject *child = *iter;
+ if (child->metaObject() == &QmlBindableValue::staticMetaObject) {
+ QmlBindableValue *v = static_cast<QmlBindableValue *>(child);
+ if (v->property() == *this && v->enabled()) {
+
+ v->setEnabled(false);
+
+ if (binding) {
+ binding->setParent(object());
+ binding->setTarget(*this);
+ binding->setEnabled(true);
+ binding->forceUpdate();
+ }
+
+ return v;
+
+ }
+ }
+ }
+
+ if (binding) {
+ binding->setParent(object());
+ binding->setTarget(*this);
+ binding->setEnabled(true);
+ binding->forceUpdate();
+ }
+
+ return 0;
+}
+
/*! \internal */
int QmlMetaProperty::findSignal(const QObject *obj, const char *name)
{
diff --git a/src/declarative/qml/qmlmetaproperty.h b/src/declarative/qml/qmlmetaproperty.h
index 9daef59..ce2fbcf 100644
--- a/src/declarative/qml/qmlmetaproperty.h
+++ b/src/declarative/qml/qmlmetaproperty.h
@@ -123,7 +123,9 @@ public:
QMetaProperty property() const;
- QmlBindableValue *binding();
+ QmlBindableValue *binding() const;
+ QmlBindableValue *setBinding(QmlBindableValue *) const;
+
static int findSignal(const QObject *, const char *);
int coreIndex() const;
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index a3ee4e5..962d917 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -564,7 +564,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledComp
QmlMetaProperty mp(target, instr.assignBinding.property,
(QmlMetaProperty::PropertyCategory)instr.assignBinding.category);
- QmlBindableValue *bind = new QmlBindableValue((void *)datas.at(instr.assignBinding.value).constData(), comp, context, 0);
+ QmlBindableValue *bind = new QmlBindableValue((void *)datas.at(instr.assignBinding.value).constData(), comp, context, QmlContext::activeContext(), 0);
bindValues.append(bind);
QmlBindableValuePrivate *p =
static_cast<QmlBindableValuePrivate *>(QObjectPrivate::get(bind));
@@ -584,7 +584,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledComp
QmlMetaProperty mp(target, instr.assignBinding.property,
(QmlMetaProperty::PropertyCategory)instr.assignBinding.category);
- QmlBindableValue *bind = new QmlBindableValue(primitives.at(instr.assignBinding.value), context, false);
+ QmlBindableValue *bind = new QmlBindableValue(primitives.at(instr.assignBinding.value), context, QmlContext::activeContext());
bindValues.append(bind);
QmlBindableValuePrivate *p =
static_cast<QmlBindableValuePrivate *>(QObjectPrivate::get(bind));
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index 2a6cad9..e5f1138 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -958,8 +958,6 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
myAction.fromValue = QVariant(d->fromValue);
myAction.toValue = QVariant(d->toValue);
- myAction.bv = 0;
- myAction.event = 0;
data->actions << myAction;
}
}
@@ -1766,8 +1764,6 @@ void QmlNumericAnimation::transition(QmlStateActions &actions,
myAction.fromValue = QVariant(d->from);
myAction.toValue = QVariant(d->to);
- myAction.bv = 0;
- myAction.event = 0;
data->actions << myAction;
}
}
@@ -2332,8 +2328,6 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
d->convertVariant(d->to, (QVariant::Type)myAction.property.propertyType());
myAction.toValue = d->to;
- myAction.bv = 0;
- myAction.event = 0;
data->actions << myAction;
}
}
diff --git a/src/declarative/util/qmlsetproperties.cpp b/src/declarative/util/qmlsetproperties.cpp
index cb97ed9..240e37b 100644
--- a/src/declarative/util/qmlsetproperties.cpp
+++ b/src/declarative/util/qmlsetproperties.cpp
@@ -47,6 +47,7 @@
#include <private/qmlcustomparser_p.h>
#include <private/qmlparser_p.h>
#include <QtDeclarative/qmlexpression.h>
+#include <QtDeclarative/qmlbindablevalue.h>
QT_BEGIN_NAMESPACE
@@ -113,7 +114,8 @@ class QmlSetPropertiesPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QmlSetProperties)
public:
- QmlSetPropertiesPrivate() : object(0), decoded(true), restore(true) {}
+ QmlSetPropertiesPrivate() : object(0), decoded(true), restore(true),
+ isExplicit(false) {}
QObject *object;
QByteArray data;
@@ -121,6 +123,7 @@ public:
void decode();
bool restore;
+ bool isExplicit;
QList<QPair<QByteArray, QVariant> > properties;
QList<QPair<QByteArray, QmlExpression *> > expressions;
@@ -205,6 +208,7 @@ QmlSetPropertiesParser::compile(const QList<QmlCustomParserProperty> &props,
void QmlSetPropertiesPrivate::decode()
{
+ Q_Q(QmlSetProperties);
if (decoded)
return;
@@ -221,7 +225,7 @@ void QmlSetPropertiesPrivate::decode()
ds >> data;
if (isScript) {
- QmlExpression *expression = new QmlExpression(qmlContext(object), data.toString(), object);
+ QmlExpression *expression = new QmlExpression(qmlContext(q), data.toString(), object);
expression->setTrackChange(false);
expressions << qMakePair(name, expression);
} else {
@@ -347,7 +351,13 @@ QmlSetProperties::ActionList QmlSetProperties::actions()
a.restore = restoreEntryValues();
a.property = prop;
a.fromValue = a.property.read();
- a.toValue = d->expressions.at(ii).second->value();
+
+ if (d->isExplicit) {
+ a.toValue = d->expressions.at(ii).second->value();
+ } else {
+ a.toBinding = new QmlBindableValue(d->expressions.at(ii).second->expression(), object(), qmlContext(this));
+ a.toBinding->setTarget(prop);
+ }
list << a;
}
@@ -357,6 +367,18 @@ QmlSetProperties::ActionList QmlSetProperties::actions()
return list;
}
+bool QmlSetProperties::isExplicit() const
+{
+ Q_D(const QmlSetProperties);
+ return d->isExplicit;
+}
+
+void QmlSetProperties::setIsExplicit(bool e)
+{
+ Q_D(QmlSetProperties);
+ d->isExplicit = e;
+}
+
QML_DEFINE_CUSTOM_TYPE(QmlSetProperties,SetProperties,QmlSetPropertiesParser)
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlsetproperties.h b/src/declarative/util/qmlsetproperties.h
index da5fcf2..fe98900 100644
--- a/src/declarative/util/qmlsetproperties.h
+++ b/src/declarative/util/qmlsetproperties.h
@@ -59,6 +59,7 @@ class Q_DECLARATIVE_EXPORT QmlSetProperties : public QmlStateOperation
Q_PROPERTY(QObject *target READ object WRITE setObject)
Q_PROPERTY(bool restoreEntryValues READ restoreEntryValues WRITE setRestoreEntryValues)
+ Q_PROPERTY(bool explicit READ isExplicit WRITE setIsExplicit);
public:
QmlSetProperties();
~QmlSetProperties();
@@ -69,6 +70,9 @@ public:
bool restoreEntryValues() const;
void setRestoreEntryValues(bool);
+ bool isExplicit() const;
+ void setIsExplicit(bool);
+
virtual ActionList actions();
};
QML_DECLARE_TYPE(QmlSetProperties)
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index 0574224..fe215e7 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG);
-Action::Action() : restore(true), bv(0), event(0), actionDone(false)
+Action::Action() : restore(true), actionDone(false), fromBinding(0), toBinding(0), event(0)
{
}
@@ -237,8 +237,9 @@ QmlState &QmlState::operator<<(QmlStateOperation *op)
void QmlStatePrivate::applyBindings()
{
foreach(const Action &action, bindingsList) {
- if (action.bv && !action.toBinding.isEmpty()) {
- action.bv->setExpression(action.toBinding);
+ if (action.toBinding) {
+ action.property.setBinding(action.toBinding);
+ action.toBinding->forceUpdate();
}
}
}
@@ -246,6 +247,7 @@ void QmlStatePrivate::applyBindings()
void QmlStatePrivate::complete()
{
Q_Q(QmlState);
+
//apply bindings (now that all transitions are complete)
applyBindings();
@@ -316,6 +318,15 @@ void QmlState::cancel()
}
}
+void Action::deleteFromBinding()
+{
+ if (fromBinding) {
+ property.setBinding(0);
+ delete fromBinding;
+ fromBinding = 0;
+ }
+}
+
void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *revert)
{
Q_D(QmlState);
@@ -341,20 +352,36 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
QmlStatePrivate::SimpleActionList additionalReverts;
// First add the reverse of all the applyList actions
for (int ii = 0; ii < applyList.count(); ++ii) {
- const Action &action = applyList.at(ii);
- if (action.event || !action.restore)
+ Action &action = applyList[ii];
+
+ if (action.event)
continue;
+ action.fromBinding = action.property.binding();
+
bool found = false;
- for (int jj = 0; !found && jj < d->revertList.count(); ++jj) {
- if (d->revertList.at(jj).property == action.property)
+ int jj;
+ for (jj = 0; jj < d->revertList.count(); ++jj) {
+ if (d->revertList.at(jj).property == action.property) {
found = true;
+ break;
+ }
}
+
if (!found) {
- // Only need to revert the applyList action if the previous
- // state doesn't have a higher priority revert already
- SimpleAction r(action);
- additionalReverts << r;
+ if (!action.restore) {
+ action.deleteFromBinding();
+ } else {
+ // Only need to revert the applyList action if the previous
+ // state doesn't have a higher priority revert already
+ SimpleAction r(action);
+ additionalReverts << r;
+ }
+ } else {
+
+ if (!found || d->revertList.at(jj).binding != action.fromBinding) {
+ action.deleteFromBinding();
+ }
}
}
@@ -369,15 +396,13 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
}
if (!found) {
QVariant cur = d->revertList.at(ii).property.read();
+ delete d->revertList.at(ii).property.setBinding(0);
+
Action a;
a.property = d->revertList.at(ii).property;
a.fromValue = cur;
a.toValue = d->revertList.at(ii).value;
a.toBinding = d->revertList.at(ii).binding;
- if (!a.toBinding.isEmpty()) {
- a.fromBinding = d->revertList.at(ii).bv->expression();
- a.bv = d->revertList.at(ii).bv;
- }
applyList << a;
// Store these special reverts in the reverting list
d->reverting << d->revertList.at(ii).property;
@@ -396,9 +421,12 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
// Determine which actions are binding changes.
foreach(const Action &action, applyList) {
- if (action.bv && !action.toBinding.isEmpty()) {
+ if (action.toBinding) {
d->bindingsList << action;
- action.bv->clearExpression();
+ if (action.fromBinding)
+ action.property.setBinding(0); // Disable current binding
+ } else if (action.fromBinding) {
+ action.property.setBinding(0); // Disable current binding
}
}
@@ -415,8 +443,9 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
// Apply all the property and binding changes
foreach(const Action &action, applyList) {
- if (action.bv && !action.toBinding.isEmpty()) {
- action.bv->setExpression(action.toBinding);
+ if (action.toBinding) {
+ action.property.setBinding(action.toBinding);
+ action.toBinding->forceUpdate();
} else if (!action.event) {
action.property.write(action.toValue);
}
@@ -429,9 +458,8 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
continue;
const QmlMetaProperty &prop = action->property;
- if (action->bv && !action->toBinding.isEmpty()) {
+ if (action->toBinding)
action->toValue = prop.read();
- }
}
// Revert back to the original values
@@ -439,8 +467,9 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
if (action.event)
continue;
- if (action.bv && !action.toBinding.isEmpty())
- action.bv->clearExpression();
+ if (action.toBinding)
+ action.property.setBinding(0);
+
action.property.write(action.fromValue);
}
}
@@ -480,12 +509,15 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
}
// Any actions remaining have not been handled by the transition and should
- // be applied immediately
+ // be applied immediately. We skip applying transitions, as they are all
+ // applied at the end in applyBindings() to avoid any nastiness mid
+ // transition
foreach(const Action &action, applyList) {
- if (action.event)
+ if (action.event) {
action.event->execute();
- else
+ } else {
action.property.write(action.toValue);
+ }
}
if (!trans)
d->applyBindings(); //### merge into above foreach?
diff --git a/src/declarative/util/qmlstate.h b/src/declarative/util/qmlstate.h
index 59ef812..e9a173c 100644
--- a/src/declarative/util/qmlstate.h
+++ b/src/declarative/util/qmlstate.h
@@ -60,15 +60,18 @@ class Action
public:
Action();
+ bool restore:1;
+ bool actionDone:1;
+
QmlMetaProperty property;
- bool restore;
QVariant fromValue;
QVariant toValue;
- QString fromBinding;
- QString toBinding;
- QmlBindableValue *bv;
+
+ QmlBindableValue *fromBinding;
+ QmlBindableValue *toBinding;
ActionEvent *event;
- bool actionDone;
+
+ void deleteFromBinding();
};
class ActionEvent
diff --git a/src/declarative/util/qmlstate_p.h b/src/declarative/util/qmlstate_p.h
index 7fcbcd7..b4ec476 100644
--- a/src/declarative/util/qmlstate_p.h
+++ b/src/declarative/util/qmlstate_p.h
@@ -52,23 +52,21 @@ class SimpleAction
{
public:
enum State { StartState, EndState };
- SimpleAction(const Action &a, State state = StartState) : bv(0)
+ SimpleAction(const Action &a, State state = StartState)
{
property = a.property;
if (state == StartState) {
value = a.fromValue;
- binding = a.fromBinding;
+ binding = property.binding();
} else {
value = a.toValue;
binding = a.toBinding;
}
- bv = a.bv;
}
QmlMetaProperty property;
QVariant value;
- QString binding;
- QmlBindableValue *bv;
+ QmlBindableValue *binding;
};
class QmlStatePrivate : public QObjectPrivate
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index 02b54f8..b7398a3 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -417,14 +417,8 @@ QmlSetProperty::ActionList QmlSetProperty::actions()
a.property = prop;
a.fromValue = cur;
a.toValue = d->value;
- if (!d->binding.isEmpty()) {
- QmlBindableValue *bv = prop.binding();
- if (bv) {
- a.fromBinding = bv->expression();
- a.bv = bv;
- }
- }
- a.toBinding = d->binding;
+ if (!d->binding.isEmpty())
+ a.toBinding = new QmlBindableValue(d->binding, object(), qmlContext(this));
return ActionList() << a;
}
diff --git a/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml
index 61cedc2..9cb2509 100644
--- a/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml
+++ b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml
@@ -13,15 +13,13 @@ Rect {
states: [
State {
name: "hello"
- SetProperty {
+ SetProperties {
target: MyRect
- property: "x"
- binding: 100
+ x: 100
}
- SetProperty {
+ SetProperties {
target: MyMouseRegion
- property: "onClicked"
- value: "Page.currentState = ''"
+ onClicked: "Page.currentState = ''"
}
}
]
diff --git a/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml b/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml
index d351b8c..cb631d4 100644
--- a/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml
+++ b/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml
@@ -5,18 +5,16 @@ Rect {
states: [
State {
name: "first"
- SetProperty {
+ SetProperties {
target: mainrect
- property: "color"
- value: "red"
+ color: "red"
}
},
State {
name: "second"
- SetProperty {
+ SetProperties {
target: mainrect
- property: "color"
- value: "blue"
+ color: "blue"
}
}
]
diff --git a/tests/auto/declarative/visual/easing/easing.qml b/tests/auto/declarative/visual/easing/easing.qml
index 4a0ed14..14622c9 100644
--- a/tests/auto/declarative/visual/easing/easing.qml
+++ b/tests/auto/declarative/visual/easing/easing.qml
@@ -148,19 +148,17 @@ Rect {
State {
name: "from"
when: !mouse.pressed
- SetProperty {
+ SetProperties {
target: text
- property: "x"
- value: 0
+ x: 0
}
},
State {
name: "to"
when: mouse.pressed
- SetProperty {
+ SetProperties {
target: text
- property: "x"
- value: item.width-100
+ x: item.width-100
}
}
]