From 08a4fffc4c93c324f95f5759c620287330c68d9d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 21 Aug 2009 13:27:52 +1000 Subject: Rename State change elements. SetProperties -> PropertyChanges RunScript -> StateChangeScript SetAnchors -> AnchorChanges --- demos/declarative/calculator/CalcButton.qml | 8 +- demos/declarative/calculator/calculator.qml | 14 +- demos/declarative/contacts/Button.qml | 2 +- demos/declarative/contacts/ContactField.qml | 4 +- demos/declarative/contacts/FieldText.qml | 18 +- demos/declarative/contacts/RemoveButton.qml | 10 +- demos/declarative/contacts/contacts.qml | 18 +- demos/declarative/flickr/content/ImageDetails.qml | 2 +- demos/declarative/flickr/content/MediaButton.qml | 2 +- demos/declarative/flickr/content/MediaLineEdit.qml | 14 +- demos/declarative/flickr/content/ScrollBar.qml | 2 +- demos/declarative/flickr/content/Star.qml | 2 +- demos/declarative/flickr/flickr.qml | 26 +- demos/declarative/flickr/flickr2.qml | 28 +- demos/declarative/samegame/content/BoomBlock.qml | 10 +- .../declarative/webbrowser/fieldtext/FieldText.qml | 12 +- demos/declarative/webbrowser/webbrowser.qml | 28 +- examples/declarative/dynamic/DynRect.qml | 2 +- examples/declarative/flowview/flowview.qml | 14 +- examples/declarative/follow/follow.qml | 2 +- examples/declarative/layouts/Button.qml | 4 +- .../declarative/listview/content/MediaButton.qml | 2 +- examples/declarative/listview/highlight.qml | 2 +- examples/declarative/listview/recipes.qml | 14 +- examples/declarative/loader/Browser.qml | 4 +- examples/declarative/minehunt/Explosion.qml | 6 +- examples/declarative/minehunt/minehunt.qml | 2 +- examples/declarative/scrollbar/display.qml | 4 +- examples/declarative/slideswitch/Switch.qml | 8 +- examples/declarative/snow/ImageBatch.qml | 4 +- examples/declarative/states/states.qml | 4 +- examples/declarative/states/transitions.qml | 4 +- .../1_Drawing_and_Animation/4/RemoveButton.qml | 10 +- .../1_Drawing_and_Animation/4a/RemoveButton.qml | 10 +- .../1_Drawing_and_Animation/5/RemoveButton.qml | 10 +- .../tutorials/contacts/2_Reuse/1/RemoveButton.qml | 10 +- .../tutorials/contacts/2_Reuse/1a/RemoveButton.qml | 10 +- .../contacts/2_Reuse/1b/lib/RemoveButton.qml | 10 +- .../tutorials/contacts/2_Reuse/2/RemoveButton.qml | 10 +- .../tutorials/contacts/2_Reuse/3/ContactField.qml | 4 +- .../tutorials/contacts/2_Reuse/3/FieldText.qml | 14 +- .../tutorials/contacts/2_Reuse/3/RemoveButton.qml | 10 +- .../tutorials/contacts/2_Reuse/4/ContactField.qml | 4 +- .../tutorials/contacts/2_Reuse/4/FieldText.qml | 14 +- .../tutorials/contacts/2_Reuse/4/RemoveButton.qml | 10 +- .../contacts/3_Collections/2/ContactView.qml | 10 +- .../contacts/3_Collections/3/ContactView.qml | 10 +- .../contacts/3_Collections/lib/Button.qml | 2 +- .../contacts/3_Collections/lib/ContactField.qml | 4 +- .../contacts/3_Collections/lib/FieldText.qml | 14 +- .../contacts/3_Collections/lib/RemoveButton.qml | 10 +- .../tutorials/helloworld/t3/tutorial3.qml | 2 +- examples/declarative/velocity/Day.qml | 4 +- examples/declarative/xmldata/yahoonews.qml | 4 +- src/declarative/QmlChanges.txt | 6 +- src/declarative/util/qmlanimation.cpp | 6 +- src/declarative/util/qmlconnection.cpp | 2 - src/declarative/util/qmlpropertychanges.cpp | 339 +++++++++++++++++++++ src/declarative/util/qmlpropertychanges.h | 84 +++++ src/declarative/util/qmlsetproperties.cpp | 339 --------------------- src/declarative/util/qmlsetproperties.h | 84 ----- src/declarative/util/qmlstateoperations.cpp | 134 ++++---- src/declarative/util/qmlstateoperations.h | 24 +- src/declarative/util/util.pri | 4 +- 64 files changed, 741 insertions(+), 743 deletions(-) create mode 100644 src/declarative/util/qmlpropertychanges.cpp create mode 100644 src/declarative/util/qmlpropertychanges.h delete mode 100644 src/declarative/util/qmlsetproperties.cpp delete mode 100644 src/declarative/util/qmlsetproperties.h diff --git a/demos/declarative/calculator/CalcButton.qml b/demos/declarative/calculator/CalcButton.qml index 04dbfc9..0fb5412 100644 --- a/demos/declarative/calculator/CalcButton.qml +++ b/demos/declarative/calculator/CalcButton.qml @@ -29,13 +29,13 @@ Rectangle { states: [ State { name: "Pressed"; when: MouseRegion.pressed == true - SetProperties { target: G1; color: Palette.dark } - SetProperties { target: G2; color: Palette.button } + PropertyChanges { target: G1; color: Palette.dark } + PropertyChanges { target: G2; color: Palette.button } }, State { name: "Toggled"; when: Button.toggled == true - SetProperties { target: G1; color: Palette.dark } - SetProperties { target: G2; color: Palette.button } + PropertyChanges { target: G1; color: Palette.dark } + PropertyChanges { target: G2; color: Palette.button } } ] } diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml index fd5002b..24c3e69 100644 --- a/demos/declarative/calculator/calculator.qml +++ b/demos/declarative/calculator/calculator.qml @@ -111,13 +111,13 @@ Rectangle { states: [ State { name: "Advanced"; when: AdvancedCheckBox.toggled == true - SetProperties { target: BasicButtons; x: 0 } - SetProperties { target: SimpleOperations; y: 32 } - SetProperties { target: Bksp; opacity: 1 } - SetProperties { target: C; x: 69; width: 67 } - SetProperties { target: AC; x: 138; width: 67 } - SetProperties { target: Equals; width: 50 } - SetProperties { target: AdvancedButtons; x: 210; opacity: 1 } + PropertyChanges { target: BasicButtons; x: 0 } + PropertyChanges { target: SimpleOperations; y: 32 } + PropertyChanges { target: Bksp; opacity: 1 } + PropertyChanges { target: C; x: 69; width: 67 } + PropertyChanges { target: AC; x: 138; width: 67 } + PropertyChanges { target: Equals; width: 50 } + PropertyChanges { target: AdvancedButtons; x: 210; opacity: 1 } } ] diff --git a/demos/declarative/contacts/Button.qml b/demos/declarative/contacts/Button.qml index bdfc22e..476f170 100644 --- a/demos/declarative/contacts/Button.qml +++ b/demos/declarative/contacts/Button.qml @@ -26,7 +26,7 @@ Item { State { name: "pressed" when: buttonMouseRegion.pressed == true - SetProperties { + PropertyChanges { target: buttonRect color: "green" } diff --git a/demos/declarative/contacts/ContactField.qml b/demos/declarative/contacts/ContactField.qml index 69401f9..8fb627d 100644 --- a/demos/declarative/contacts/ContactField.qml +++ b/demos/declarative/contacts/ContactField.qml @@ -36,11 +36,11 @@ Item { State { name: "editingText" when: fieldText.state == 'editing' - SetProperties { + PropertyChanges { target: removeButton.anchors rightMargin: -35 } - SetProperties { + PropertyChanges { target: fieldText width: contactField.width } diff --git a/demos/declarative/contacts/FieldText.qml b/demos/declarative/contacts/FieldText.qml index 95805f7..6793b7c 100644 --- a/demos/declarative/contacts/FieldText.qml +++ b/demos/declarative/contacts/FieldText.qml @@ -98,39 +98,39 @@ Rectangle { states: [ State { name: "editing" - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: fieldText color: "white" } - SetProperties { + PropertyChanges { target: textEdit color: "black" } - SetProperties { + PropertyChanges { target: textEdit readOnly: false } - SetProperties { + PropertyChanges { target: textEdit focus: true } - SetProperties { + PropertyChanges { target: editRegion opacity: 0 } - SetProperties { + PropertyChanges { target: textEdit.anchors leftMargin: 34 } - SetProperties { + PropertyChanges { target: textEdit.anchors rightMargin: 34 } diff --git a/demos/declarative/contacts/RemoveButton.qml b/demos/declarative/contacts/RemoveButton.qml index b01d89f..2493f65 100644 --- a/demos/declarative/contacts/RemoveButton.qml +++ b/demos/declarative/contacts/RemoveButton.qml @@ -87,23 +87,23 @@ Rectangle { states: [ State { name: "opened" - SetProperties { + PropertyChanges { target: removeButton width: removeButton.expandedWidth } - SetProperties { + PropertyChanges { target: text opacity: 1 } - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: trashIcon opacity: 0 } diff --git a/demos/declarative/contacts/contacts.qml b/demos/declarative/contacts/contacts.qml index 0082ecf..3be2b04 100644 --- a/demos/declarative/contacts/contacts.qml +++ b/demos/declarative/contacts/contacts.qml @@ -52,7 +52,7 @@ Rectangle { State { name: "currentItem" when: wrapper.ListView.isCurrentItem - SetProperties { + PropertyChanges { target: label color: "black" } @@ -95,23 +95,23 @@ Rectangle { states: [ State { name: "opened" - SetProperties { + PropertyChanges { target: wrapper height: contactListView.height } - SetProperties { + PropertyChanges { target: contactListView yPosition: wrapper.y } - SetProperties { + PropertyChanges { target: contactListView locked: 1 } - SetProperties { + PropertyChanges { target: label opacity: 0 } - SetProperties { + PropertyChanges { target: Details opacity: 1 } @@ -273,7 +273,7 @@ Rectangle { State { name: "searchHidden" when: searchBar.text == '' || contacts.mode != 'list' - SetProperties { + PropertyChanges { target: searchBarWrapper.anchors bottomMargin: -30 } @@ -298,11 +298,11 @@ Rectangle { State { name: "editNewState" when: contacts.mode == 'new' - SetProperties { + PropertyChanges { target: contactListView opacity: 0 } - SetProperties { + PropertyChanges { target: newContactWrapper opacity: 1 } diff --git a/demos/declarative/flickr/content/ImageDetails.qml b/demos/declarative/flickr/content/ImageDetails.qml index bfa3e01..5db1e99 100644 --- a/demos/declarative/flickr/content/ImageDetails.qml +++ b/demos/declarative/flickr/content/ImageDetails.qml @@ -136,7 +136,7 @@ Flipable { states: [ State { name: "Back" - SetProperties { target: Rotation; angle: 180 } + PropertyChanges { target: Rotation; angle: 180 } } ] diff --git a/demos/declarative/flickr/content/MediaButton.qml b/demos/declarative/flickr/content/MediaButton.qml index 2a6dbae..0ffd596 100644 --- a/demos/declarative/flickr/content/MediaButton.qml +++ b/demos/declarative/flickr/content/MediaButton.qml @@ -32,7 +32,7 @@ Item { State { name: "Pressed" when: MouseRegion.pressed == true - SetProperties { + PropertyChanges { target: Pressed opacity: 1 } diff --git a/demos/declarative/flickr/content/MediaLineEdit.qml b/demos/declarative/flickr/content/MediaLineEdit.qml index 1642d44..500a402 100644 --- a/demos/declarative/flickr/content/MediaLineEdit.qml +++ b/demos/declarative/flickr/content/MediaLineEdit.qml @@ -12,30 +12,30 @@ Item { states: [ State { name: "Edit" - SetProperties { + PropertyChanges { target: Label text: Container.label + ": " } - SetProperties { + PropertyChanges { target: Label x: 10 } - SetProperties { + PropertyChanges { target: Editor cursorVisible: true width: 100 } - SetProperties { + PropertyChanges { target: Proxy focus: true } - RunScript { + StateChangeScript { script:"Editor.selectAll()" } }, State { // When returning to default state, typed text is propagated - RunScript { + StateChangeScript { script: "Container.text = Editor.text" } } @@ -69,7 +69,7 @@ Item { states: [ State { when: MouseRegion.pressed == true - SetProperties { + PropertyChanges { target: Pressed opacity: 1 } diff --git a/demos/declarative/flickr/content/ScrollBar.qml b/demos/declarative/flickr/content/ScrollBar.qml index 9c78326..540f94f 100644 --- a/demos/declarative/flickr/content/ScrollBar.qml +++ b/demos/declarative/flickr/content/ScrollBar.qml @@ -20,7 +20,7 @@ Item { State { name: "show" when: flickableArea.moving - SetProperties { + PropertyChanges { target: Container opacity: 1 } diff --git a/demos/declarative/flickr/content/Star.qml b/demos/declarative/flickr/content/Star.qml index 5a6a95d..006e86ad 100644 --- a/demos/declarative/flickr/content/Star.qml +++ b/demos/declarative/flickr/content/Star.qml @@ -26,7 +26,7 @@ Item { State { name: "on" when: Container.on == true - SetProperties { + PropertyChanges { target: Image opacity: 1 scale: 1 diff --git a/demos/declarative/flickr/flickr.qml b/demos/declarative/flickr/flickr.qml index e4d7fe2..81134d3 100644 --- a/demos/declarative/flickr/flickr.qml +++ b/demos/declarative/flickr/flickr.qml @@ -83,18 +83,18 @@ Item { states: [ State { name: "Details" - SetProperties { target: ImageDetails; z: 2 } + PropertyChanges { target: ImageDetails; z: 2 } ParentChange { target: Wrapper; parent: ImageDetails.frontContainer } - SetProperties { target: Wrapper; x: 45; y: 35; scale: 1; z: 1000 } - SetProperties { target: Rotation; angle: 0 } - SetProperties { target: Shadows; opacity: 0 } - SetProperties { target: ImageDetails; y: 20 } - SetProperties { target: PhotoGridView; y: "-480" } - SetProperties { target: PhotoPathView; y: "-480" } - SetProperties { target: ViewModeButton; opacity: 0 } - SetProperties { target: TagsEdit; opacity: 0 } - SetProperties { target: FetchButton; opacity: 0 } - SetProperties { target: CategoryText; y: "-50" } + PropertyChanges { target: Wrapper; x: 45; y: 35; scale: 1; z: 1000 } + PropertyChanges { target: Rotation; angle: 0 } + PropertyChanges { target: Shadows; opacity: 0 } + PropertyChanges { target: ImageDetails; y: 20 } + PropertyChanges { target: PhotoGridView; y: "-480" } + PropertyChanges { target: PhotoPathView; y: "-480" } + PropertyChanges { target: ViewModeButton; opacity: 0 } + PropertyChanges { target: TagsEdit; opacity: 0 } + PropertyChanges { target: FetchButton; opacity: 0 } + PropertyChanges { target: CategoryText; y: "-50" } } ] @@ -189,8 +189,8 @@ Item { State { name: "PathView" when: MainWindow.showPathView == true - SetProperties { target: PhotoPathView; y: 80 } - SetProperties { target: PhotoGridView; y: -380 } + PropertyChanges { target: PhotoPathView; y: 80 } + PropertyChanges { target: PhotoGridView; y: -380 } } ] diff --git a/demos/declarative/flickr/flickr2.qml b/demos/declarative/flickr/flickr2.qml index 5fb580c..1c28d51 100644 --- a/demos/declarative/flickr/flickr2.qml +++ b/demos/declarative/flickr/flickr2.qml @@ -82,18 +82,18 @@ Item { states: [ State { name: "Details" - SetProperties { target: Background.imageDetails; z: 2 } + PropertyChanges { target: Background.imageDetails; z: 2 } ParentChange { target: Wrapper; parent: Background.imageDetails.frontContainer } - SetProperties { target: Wrapper; x: 45; y: 35; scale: 1; z: 1000 } - SetProperties { target: Rotation; angle: 0 } - SetProperties { target: Shadows; opacity: 0 } - SetProperties { target: Background.imageDetails; y: 20 } - SetProperties { target: PhotoGridView; y: "-480" } - SetProperties { target: PhotoPathView; y: "-480" } - SetProperties { target: ViewModeButton; opacity: 0 } - SetProperties { target: TagsEdit; opacity: 0 } - SetProperties { target: FetchButton; opacity: 0 } - SetProperties { target: CategoryText; y: "-50" } + PropertyChanges { target: Wrapper; x: 45; y: 35; scale: 1; z: 1000 } + PropertyChanges { target: Rotation; angle: 0 } + PropertyChanges { target: Shadows; opacity: 0 } + PropertyChanges { target: Background.imageDetails; y: 20 } + PropertyChanges { target: PhotoGridView; y: "-480" } + PropertyChanges { target: PhotoPathView; y: "-480" } + PropertyChanges { target: ViewModeButton; opacity: 0 } + PropertyChanges { target: TagsEdit; opacity: 0 } + PropertyChanges { target: FetchButton; opacity: 0 } + PropertyChanges { target: CategoryText; y: "-50" } } ] @@ -130,12 +130,12 @@ Item { states: [ State { name: "gridView" - SetProperties { target: Wrapper; explicit: true; property: "moveToParent"; value: GridViewPackage } + PropertyChanges { target: Wrapper; explicit: true; property: "moveToParent"; value: GridViewPackage } }, State { name: "pathView" - SetProperties { target: Wrapper; scale: PathViewPackage.PathView.scale; angle: PathViewPackage.PathView.angle; } - SetProperties { target: Wrapper; explicit: true; moveToParent: PathViewPackage } + PropertyChanges { target: Wrapper; scale: PathViewPackage.PathView.scale; angle: PathViewPackage.PathView.angle; } + PropertyChanges { target: Wrapper; explicit: true; moveToParent: PathViewPackage } } ] transitions: [ diff --git a/demos/declarative/samegame/content/BoomBlock.qml b/demos/declarative/samegame/content/BoomBlock.qml index 8a505da..7860cf4 100644 --- a/demos/declarative/samegame/content/BoomBlock.qml +++ b/demos/declarative/samegame/content/BoomBlock.qml @@ -42,13 +42,13 @@ Item { id:block states: [ State{ name: "AliveState"; when: spawned == true && dying == false - SetProperties { target: img; opacity: 1 } + PropertyChanges { target: img; opacity: 1 } }, State{ name: "DeathState"; when: dying == true - SetProperties { target: particles; count: 50 } - SetProperties { target: particles; opacity: 1 } - SetProperties { target: particles; emitting: false } // i.e. emit only once - SetProperties { target: img; opacity: 0 } + PropertyChanges { target: particles; count: 50 } + PropertyChanges { target: particles; opacity: 1 } + PropertyChanges { target: particles; emitting: false } // i.e. emit only once + PropertyChanges { target: img; opacity: 0 } } ] } diff --git a/demos/declarative/webbrowser/fieldtext/FieldText.qml b/demos/declarative/webbrowser/fieldtext/FieldText.qml index cbacfd8..4d59705 100644 --- a/demos/declarative/webbrowser/fieldtext/FieldText.qml +++ b/demos/declarative/webbrowser/fieldtext/FieldText.qml @@ -115,15 +115,15 @@ Item { states: [ State { name: "editing" - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: textEdit color: "black" readOnly: false @@ -131,15 +131,15 @@ Item { selectionStart: 0 selectionEnd: -1 } - SetProperties { + PropertyChanges { target: editRegion opacity: 0 } - SetProperties { + PropertyChanges { target: textEdit.anchors leftMargin: 34 } - SetProperties { + PropertyChanges { target: textEdit.anchors rightMargin: 34 } diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 8d5bc6d..2e57c72 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -160,12 +160,12 @@ Item { State { name: "Normal" when: MyWebView.progress == 1.0 - SetProperties { target: Header; progressOff: 1 } + PropertyChanges { target: Header; progressOff: 1 } }, State { name: "ProgressShown" when: MyWebView.progress < 1.0 - SetProperties { target: Header; progressOff: 0; } + PropertyChanges { target: Header; progressOff: 0; } } ] transitions: [ @@ -256,14 +256,14 @@ Item { State { name: "Enabled" when: MyWebView.back.enabled==true - SetProperties { target: back_e; opacity: 1 } - SetProperties { target: back_d; opacity: 0 } + PropertyChanges { target: back_e; opacity: 1 } + PropertyChanges { target: back_d; opacity: 0 } }, State { name: "Disabled" when: MyWebView.back.enabled==false - SetProperties { target: back_e; opacity: 0 } - SetProperties { target: back_d; opacity: 1 } + PropertyChanges { target: back_e; opacity: 0 } + PropertyChanges { target: back_d; opacity: 1 } } ] transitions: [ @@ -312,14 +312,14 @@ Item { State { name: "Enabled" when: MyWebView.forward.enabled==true - SetProperties { target: forward_e; opacity: 1 } - SetProperties { target: forward_d; opacity: 0 } + PropertyChanges { target: forward_e; opacity: 1 } + PropertyChanges { target: forward_d; opacity: 0 } }, State { name: "Disabled" when: MyWebView.forward.enabled==false - SetProperties { target: forward_e; opacity: 0 } - SetProperties { target: forward_d; opacity: 1 } + PropertyChanges { target: forward_e; opacity: 0 } + PropertyChanges { target: forward_d; opacity: 1 } } ] transitions: [ @@ -341,13 +341,13 @@ Item { states: [ State { name: "Normal" - SetProperties { target: MyWebView; zoomedOut: 0 } - SetProperties { target: Flick; explicit: true; xPosition: Math.min(MyWebView.width-Flick.width,Math.max(0,Flick.centerX-Flick.width/2)) } - SetProperties { target: Flick; explicit: true; yPosition: Math.min(MyWebView.height-Flick.height,Math.max(0,Flick.centerY-Flick.height/2)) } + PropertyChanges { target: MyWebView; zoomedOut: 0 } + PropertyChanges { target: Flick; explicit: true; xPosition: Math.min(MyWebView.width-Flick.width,Math.max(0,Flick.centerX-Flick.width/2)) } + PropertyChanges { target: Flick; explicit: true; yPosition: Math.min(MyWebView.height-Flick.height,Math.max(0,Flick.centerY-Flick.height/2)) } }, State { name: "ZoomedOut" - SetProperties { target: MyWebView; zoomedOut: 1 } + PropertyChanges { target: MyWebView; zoomedOut: 1 } } ] transitions: [ diff --git a/examples/declarative/dynamic/DynRect.qml b/examples/declarative/dynamic/DynRect.qml index fd03863..06141ea 100644 --- a/examples/declarative/dynamic/DynRect.qml +++ b/examples/declarative/dynamic/DynRect.qml @@ -1,7 +1,7 @@ import Qt 4.6 Item { - states: State{ name: "dying"; SetProperties{ target: newRect; opacity: 0 } } + states: State{ name: "dying"; PropertyChanges{ target: newRect; opacity: 0 } } transitions: Transition{ NumberAnimation{ properties: "opacity"; target: newRect; duration:500 } } diff --git a/examples/declarative/flowview/flowview.qml b/examples/declarative/flowview/flowview.qml index d40d378..9405e61 100644 --- a/examples/declarative/flowview/flowview.qml +++ b/examples/declarative/flowview/flowview.qml @@ -15,11 +15,11 @@ Rectangle { states: State { name: "rotated" - SetProperties { target: ListView; z: 2 } - SetProperties { target: TopBar; y: -30 } - SetProperties { target: BottomBar; y: 480 } - SetProperties { target: LeftBar; x: 0 } - SetProperties { target: RightBar; x: 770 } + PropertyChanges { target: ListView; z: 2 } + PropertyChanges { target: TopBar; y: -30 } + PropertyChanges { target: BottomBar; y: 480 } + PropertyChanges { target: LeftBar; x: 0 } + PropertyChanges { target: RightBar; x: 770 } } transitions: Transition { fromState: "" ; toState: "rotated" @@ -53,13 +53,13 @@ Rectangle { name: "InList" when: MyPhone.state == "rotated" ParentChange { target: MyContent; parent: List } - SetProperties { target: MyContent; x: 120; y: 0; rotation: 90} + PropertyChanges { target: MyContent; x: 120; y: 0; rotation: 90} }, State { name: "InGrid" when: MyPhone.state != "rotated" ParentChange { target: MyContent; parent: Grid } - SetProperties { target: MyContent; x: 0; y: 0; } + PropertyChanges { target: MyContent; x: 0; y: 0; } } ] transitions: [ diff --git a/examples/declarative/follow/follow.qml b/examples/declarative/follow/follow.qml index 90bd7c8..37dc2e8 100644 --- a/examples/declarative/follow/follow.qml +++ b/examples/declarative/follow/follow.qml @@ -60,7 +60,7 @@ Rectangle { State { name: "following" when: !F1.inSync || !F2.inSync - SetProperties { target: Ball; color: "#ff0000" } + PropertyChanges { target: Ball; color: "#ff0000" } } ] transitions: [ diff --git a/examples/declarative/layouts/Button.qml b/examples/declarative/layouts/Button.qml index 3f1aafc..6c2fd8d 100644 --- a/examples/declarative/layouts/Button.qml +++ b/examples/declarative/layouts/Button.qml @@ -9,8 +9,8 @@ Rectangle { border.color: "black"; color: "steelblue"; radius: 5; width: pix.wid states: State{ name:"pressed"; when:mr.pressed - SetProperties {target:text; x: 5} - SetProperties {target:pix; x:text.x+text.width + 3} + PropertyChanges {target:text; x: 5} + PropertyChanges {target:pix; x:text.x+text.width + 3} } transitions: diff --git a/examples/declarative/listview/content/MediaButton.qml b/examples/declarative/listview/content/MediaButton.qml index 8fff22b..599452d 100644 --- a/examples/declarative/listview/content/MediaButton.qml +++ b/examples/declarative/listview/content/MediaButton.qml @@ -30,7 +30,7 @@ Item { State { name: "Pressed" when: MouseRegion.pressed == true - SetProperties { + PropertyChanges { target: Pressed opacity: 1 } diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml index b1cd6be..3506ad7 100644 --- a/examples/declarative/listview/highlight.qml +++ b/examples/declarative/listview/highlight.qml @@ -25,7 +25,7 @@ Rectangle { State { name: "Current" when: Wrapper.ListView.isCurrentItem - SetProperties { target: Wrapper; x: 10 } + PropertyChanges { target: Wrapper; x: 10 } } ] transitions: [ diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml index 34cdee5..b4ad4d5 100644 --- a/examples/declarative/listview/recipes.qml +++ b/examples/declarative/listview/recipes.qml @@ -16,7 +16,7 @@ Rectangle { 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 "SetProperties" line for each element we + // rather than having a "PropertyChanges" line for each element we // want to fade. property real detailsOpacity : 0 @@ -96,17 +96,17 @@ Rectangle { states: [ State { name: "Details" - SetProperties { target: background; color: "white" } + PropertyChanges { target: background; color: "white" } // Make the picture bigger - SetProperties { target: recipePic; width: 128; height: 128 } + PropertyChanges { target: recipePic; width: 128; height: 128 } // Make details visible - SetProperties { target: wrapper; detailsOpacity: 1; x: 0 } + PropertyChanges { target: wrapper; detailsOpacity: 1; x: 0 } // Make the detailed view fill the entire list area - SetProperties { target: wrapper; height: List.height } + PropertyChanges { target: wrapper; height: List.height } // Move the list so that this item is at the top. - SetProperties { target: wrapper.ListView.view; explicit: true; yPosition: wrapper.y } + PropertyChanges { target: wrapper.ListView.view; explicit: true; yPosition: wrapper.y } // Disallow flicking while we're in detailed view - SetProperties { target: wrapper.ListView.view; locked: 1 } + PropertyChanges { target: wrapper.ListView.view; locked: 1 } } ] transitions: [ diff --git a/examples/declarative/loader/Browser.qml b/examples/declarative/loader/Browser.qml index e152779..196cdc5 100644 --- a/examples/declarative/loader/Browser.qml +++ b/examples/declarative/loader/Browser.qml @@ -55,8 +55,8 @@ Rectangle { State { name: "pressed" when: Mouse.pressed - SetProperties { target: Highlight; visible: true } - SetProperties { target: NameText; color: Palette.highlightedText } + PropertyChanges { target: Highlight; visible: true } + PropertyChanges { target: NameText; color: Palette.highlightedText } } ] } diff --git a/examples/declarative/minehunt/Explosion.qml b/examples/declarative/minehunt/Explosion.qml index b1fe848..9b8bd6e 100644 --- a/examples/declarative/minehunt/Explosion.qml +++ b/examples/declarative/minehunt/Explosion.qml @@ -20,9 +20,9 @@ Item { streamIn: false } states: [ State { name: "exploding"; when: explode == true - SetProperties { target: particles; count: 200 } - SetProperties { target: particles; opacity: 1 } - SetProperties { target: particles; emitting: false } // i.e. emit only once + PropertyChanges { target: particles; count: 200 } + PropertyChanges { target: particles; opacity: 1 } + PropertyChanges { target: particles; emitting: false } // i.e. emit only once } ] diff --git a/examples/declarative/minehunt/minehunt.qml b/examples/declarative/minehunt/minehunt.qml index b3bcaf3..ac1b398 100644 --- a/examples/declarative/minehunt/minehunt.qml +++ b/examples/declarative/minehunt/minehunt.qml @@ -69,7 +69,7 @@ Item { State { name: "back" when: modelData.flipped - SetProperties { target: flipable; angle: 180 } + PropertyChanges { target: flipable; angle: 180 } } ] transitions: [ diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml index 1359c4b..639a8cc 100644 --- a/examples/declarative/scrollbar/display.qml +++ b/examples/declarative/scrollbar/display.qml @@ -18,8 +18,8 @@ Rectangle { State { name: "ShowBars" when: View.moving - SetProperties { target: SBV; opacity: 1 } - SetProperties { target: SBH; opacity: 1 } + PropertyChanges { target: SBV; opacity: 1 } + PropertyChanges { target: SBH; opacity: 1 } } ] transitions: [ diff --git a/examples/declarative/slideswitch/Switch.qml b/examples/declarative/slideswitch/Switch.qml index b476be2..a778c1a 100644 --- a/examples/declarative/slideswitch/Switch.qml +++ b/examples/declarative/slideswitch/Switch.qml @@ -41,13 +41,13 @@ Item { states: [ State { name: "On" - SetProperties { target: Knob; x: 78 } - SetProperties { target: Switch; on: true } + PropertyChanges { target: Knob; x: 78 } + PropertyChanges { target: Switch; on: true } }, State { name: "Off" - SetProperties { target: Knob; x: 1 } - SetProperties { target: Switch; on: false } + PropertyChanges { target: Knob; x: 1 } + PropertyChanges { target: Switch; on: false } } ] transitions: [ diff --git a/examples/declarative/snow/ImageBatch.qml b/examples/declarative/snow/ImageBatch.qml index 1506943..4cf4259 100644 --- a/examples/declarative/snow/ImageBatch.qml +++ b/examples/declarative/snow/ImageBatch.qml @@ -18,7 +18,7 @@ GridView { states: State { name: "selected"; when: MyGrid.isSelected - SetProperties { target: MyGrid; z: 150 } + PropertyChanges { target: MyGrid; z: 150 } } transitions: Transition { SequentialAnimation { @@ -48,7 +48,7 @@ GridView { states: State { name: "selected" when: Root.isSelected - SetProperties { target: Root; scale: 3; z: 100 } + PropertyChanges { target: Root; scale: 3; z: 100 } } transitions: [ Transition { diff --git a/examples/declarative/states/states.qml b/examples/declarative/states/states.qml index 2dcf804..d91b558 100644 --- a/examples/declarative/states/states.qml +++ b/examples/declarative/states/states.qml @@ -28,7 +28,7 @@ Rectangle { // In state 'Position1', change the 'myrect' item x, y to 150, 50. State { name: "Position1" - SetProperties { + PropertyChanges { target: myrect x: 150 y: 50 @@ -39,7 +39,7 @@ Rectangle { // had been changed. State { name: "Position2" - SetProperties { + PropertyChanges { target: myrect y: 200 } diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml index 15c2336..0be9b01 100644 --- a/examples/declarative/states/transitions.qml +++ b/examples/declarative/states/transitions.qml @@ -28,7 +28,7 @@ Rectangle { // In state 'Position1', change the 'myrect' item x, y to 150, 50. State { name: "Position1" - SetProperties { + PropertyChanges { target: myrect x: 150 y: 50 @@ -39,7 +39,7 @@ Rectangle { // had been changed. State { name: "Position2" - SetProperties { + PropertyChanges { 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 6ceec91..ed74c4c 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 @@ -81,23 +81,23 @@ Rectangle { states: [ State { name: "opened" - SetProperties { + PropertyChanges { target: removeButton width: 230 } - SetProperties { + PropertyChanges { target: text opacity: 1 } - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: trashIcon 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 6ddb770..7dc95c8 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 @@ -88,23 +88,23 @@ Rectangle { states: [ State { name: "opened" - SetProperties { + PropertyChanges { target: removeButton width: 230 } - SetProperties { + PropertyChanges { target: text opacity: 1 } - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: trashIcon 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 d712c7a..d75eedc 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 @@ -76,23 +76,23 @@ Rectangle { states: [ State { name: "opened" - SetProperties { + PropertyChanges { target: removeButton width: 230 } - SetProperties { + PropertyChanges { target: text opacity: 1 } - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: trashIcon 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 960b007..de9f15a 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml @@ -76,23 +76,23 @@ Rectangle { states: [ State { name: "opened" - SetProperties { + PropertyChanges { target: removeButton width: 230 } - SetProperties { + PropertyChanges { target: text opacity: 1 } - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: trashIcon 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 960b007..de9f15a 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml @@ -76,23 +76,23 @@ Rectangle { states: [ State { name: "opened" - SetProperties { + PropertyChanges { target: removeButton width: 230 } - SetProperties { + PropertyChanges { target: text opacity: 1 } - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: trashIcon 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 e7a37c2..07a0814 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml @@ -78,23 +78,23 @@ Rectangle { states: [ State { name: "opened" - SetProperties { + PropertyChanges { target: removeButton width: 230 } - SetProperties { + PropertyChanges { target: text opacity: 1 } - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: trashIcon 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 affa24a..be5f871 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml @@ -83,24 +83,24 @@ Rectangle { State { name: "opened" //! [use width] - SetProperties { + PropertyChanges { target: removeButton width: removeButton.expandedWidth } //! [use width] - SetProperties { + PropertyChanges { target: text opacity: 1 } - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: trashIcon 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 7957ed1..0b9c02a 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml @@ -36,11 +36,11 @@ Item { State { name: "editingText" when: fieldText.state == 'editing' - SetProperties { + PropertyChanges { target: removeButton.anchors rightMargin: -35 } - SetProperties { + PropertyChanges { target: fieldText 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 77952eb..8a9424f 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml @@ -96,31 +96,31 @@ Rectangle { states: [ State { name: "editing" - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: textEdit readOnly: false } - SetProperties { + PropertyChanges { target: textEdit focus: true } - SetProperties { + PropertyChanges { target: editRegion opacity: 0 } - SetProperties { + PropertyChanges { target: textEdit.anchors leftMargin: 39 } - SetProperties { + PropertyChanges { target: textEdit.anchors 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 66ab36e..fc260e3 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml @@ -79,23 +79,23 @@ Rectangle { states: [ State { name: "opened" - SetProperties { + PropertyChanges { target: removeButton width: removeButton.expandedWidth } - SetProperties { + PropertyChanges { target: text opacity: 1 } - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: trashIcon 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 d637fa6..691918f 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml @@ -34,11 +34,11 @@ Item { State { name: "editingText" when: fieldText.state == 'editing' - SetProperties { + PropertyChanges { target: removeButton.anchors rightMargin: -35 } - SetProperties { + PropertyChanges { target: fieldText 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 f211213..62fb08f 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml @@ -97,31 +97,31 @@ Rectangle { states: [ State { name: "editing" - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: textEdit readOnly: false } - SetProperties { + PropertyChanges { target: textEdit focus: true } - SetProperties { + PropertyChanges { target: editRegion opacity: 0 } - SetProperties { + PropertyChanges { target: textEdit.anchors leftMargin: 39 } - SetProperties { + PropertyChanges { target: textEdit.anchors 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 ed60d00..abf8fd9 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml @@ -84,23 +84,23 @@ Rectangle { states: [ State { name: "opened" - SetProperties { + PropertyChanges { target: removeButton width: removeButton.expandedWidth } - SetProperties { + PropertyChanges { target: text opacity: 1 } - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: trashIcon 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 13e2ab1..d16e3ca 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml @@ -73,24 +73,24 @@ Item { states: [ State { name: "opened" - SetProperties { + PropertyChanges { target: wrapper height: contactListView.height } - SetProperties { + PropertyChanges { target: contactListView explicit: true yPosition: wrapper.y } - SetProperties { + PropertyChanges { target: contactListView locked: 1 } - SetProperties { + PropertyChanges { target: label opacity: 0 } - SetProperties { + PropertyChanges { target: Details 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 eac43c7..bf73367 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml @@ -91,24 +91,24 @@ Item { states: [ State { name: "opened" - SetProperties { + PropertyChanges { target: wrapper height: contactListView.height } - SetProperties { + PropertyChanges { target: contactListView explicit: true yPosition: wrapper.y } - SetProperties { + PropertyChanges { target: contactListView locked: 1 } - SetProperties { + PropertyChanges { target: label opacity: 0 } - SetProperties { + PropertyChanges { target: Details 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 bdfc22e..476f170 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml @@ -26,7 +26,7 @@ Item { State { name: "pressed" when: buttonMouseRegion.pressed == true - SetProperties { + PropertyChanges { target: buttonRect 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 d637fa6..691918f 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml @@ -34,11 +34,11 @@ Item { State { name: "editingText" when: fieldText.state == 'editing' - SetProperties { + PropertyChanges { target: removeButton.anchors rightMargin: -35 } - SetProperties { + PropertyChanges { target: fieldText 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 0dc0bf9..e05708f 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml @@ -97,31 +97,31 @@ Rectangle { states: [ State { name: "editing" - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: textEdit readOnly: false } - SetProperties { + PropertyChanges { target: textEdit focus: true } - SetProperties { + PropertyChanges { target: editRegion opacity: 0 } - SetProperties { + PropertyChanges { target: textEdit.anchors leftMargin: 39 } - SetProperties { + PropertyChanges { target: textEdit.anchors 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 af878b4..6bca8b9 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml @@ -82,24 +82,24 @@ Rectangle { states: [ State { name: "opened" - SetProperties { + PropertyChanges { target: removeButton explicit: true width: removeButton.expandedWidth } - SetProperties { + PropertyChanges { target: text opacity: 1 } - SetProperties { + PropertyChanges { target: confirmIcon opacity: 1 } - SetProperties { + PropertyChanges { target: cancelIcon opacity: 1 } - SetProperties { + PropertyChanges { target: trashIcon opacity: 0 } diff --git a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml index bab9f86..b652eac 100644 --- a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml +++ b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml @@ -16,7 +16,7 @@ Rectangle { State { name: "down" when: MouseRegion.pressed == true - SetProperties { + PropertyChanges { target: HelloText y: 160 color: "red" diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index f3f13fa..e488ae1 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -88,12 +88,12 @@ Rectangle { State { name: "pressed" when: Mouse.pressed - SetProperties { + PropertyChanges { target: Sticky rotation: 8 scale: 1 } - SetProperties { + PropertyChanges { target: Page z: 8 } diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml index d170dac..d7d47b1 100644 --- a/examples/declarative/xmldata/yahoonews.qml +++ b/examples/declarative/xmldata/yahoonews.qml @@ -66,8 +66,8 @@ Rectangle { states: [ State { name: "Details" - SetProperties { target: Wrapper; height: childrenRect.height + 10 } - SetProperties { target: Description; opacity: 1 } + PropertyChanges { target: Wrapper; height: childrenRect.height + 10 } + PropertyChanges { target: Description; opacity: 1 } } ] transitions: [ diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index f15d19e..c3bd1d2 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -17,6 +17,9 @@ FocusRealm -> FocusScope FontFamily -> FontLoader Palette -> SystemPalette Bind -> Binding +SetProperties -> PropertyChanges +RunScript -> StateChangeScript +SetAnchors -> AnchorChanges Renamed properties: MouseRegion: xmin -> minimumX @@ -51,9 +54,6 @@ Pending Changes Renamed elements: RunScriptAction -> ScriptAction ParentChangeAction -> ParentAction -SetProperties -> PropertyChanges -RunScript -> StateChangeScript -SetAnchors -> AnchorChanges Renamed properties: Transition: fromState -> from diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 7faddee..e5b7c47 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -851,10 +851,10 @@ void QmlRunScriptAction::transition(QmlStateActions &actions, for (int ii = 0; ii < actions.count(); ++ii) { Action &action = actions[ii]; - if (action.event && action.event->typeName() == QLatin1String("RunScript") - && static_cast(action.event)->name() == d->name) { + if (action.event && action.event->typeName() == QLatin1String("StateChangeScript") + && static_cast(action.event)->name() == d->name) { //### how should we handle reverse direction? - d->runScriptScript = static_cast(action.event)->script(); + d->runScriptScript = static_cast(action.event)->script(); action.actionDone = true; break; //assumes names are unique } diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp index 83804a5..6dca2d1 100644 --- a/src/declarative/util/qmlconnection.cpp +++ b/src/declarative/util/qmlconnection.cpp @@ -114,8 +114,6 @@ Connection { \class QmlConnection \brief The QmlConnection class describes generalized connections to signals. - QmlSetProperties is a mechanism for connecting a script to be run when - some object sends a signal. */ QmlConnection::QmlConnection(QObject *parent) : QObject(*(new QmlConnectionPrivate), parent) diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp new file mode 100644 index 0000000..bece267 --- /dev/null +++ b/src/declarative/util/qmlpropertychanges.cpp @@ -0,0 +1,339 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "private/qobject_p.h" +#include "qmlopenmetaobject.h" +#include "qmlpropertychanges.h" +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +/*! + \qmlclass PropertyChanges QmlPropertyChanges + \brief The PropertyChanges element describes new property values for a state. + + PropertyChanges changes the properties of an item. It allows you to specify the property + names and values similar to how you normally would specify them for the actual item: + + \code + PropertyChanges { + target: myRect + x: 52 + y: 300 + width: 48 + } + \endcode +*/ + +/*! + \internal + \class QmlPropertyChanges + \brief The QmlPropertyChanges class describes new property values for a state. +*/ + +/*! + \qmlproperty Object PropertyChanges::target + This property holds the object that the properties to change belong to +*/ + +class QmlPropertyChangesPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QmlPropertyChanges) +public: + QmlPropertyChangesPrivate() : object(0), decoded(true), restore(true), + isExplicit(false) {} + + QObject *object; + QByteArray data; + bool decoded; + void decode(); + + bool restore; + bool isExplicit; + + QList > properties; + QList > expressions; + + QmlMetaProperty property(const QByteArray &); +}; + +class QmlPropertyChangesParser : public QmlCustomParser +{ +public: + void compileList(QList > &list, const QByteArray &pre, const QmlCustomParserProperty &prop); + + virtual QByteArray compile(const QList &, bool *ok); + virtual void setCustomData(QObject *, const QByteArray &); +}; + +void +QmlPropertyChangesParser::compileList(QList > &list, + const QByteArray &pre, + const QmlCustomParserProperty &prop) +{ + QByteArray propName = pre + prop.name(); + + QList values = prop.assignedValues(); + for (int ii = 0; ii < values.count(); ++ii) { + const QVariant &value = values.at(ii); + + if (value.userType() == qMetaTypeId()) { + continue; + } else if(value.userType() == qMetaTypeId()) { + + QmlCustomParserProperty prop = + qvariant_cast(value); + QByteArray pre = propName + "."; + compileList(list, pre, prop); + + } else { + list << qMakePair(propName, value); + } + } +} + +QByteArray +QmlPropertyChangesParser::compile(const QList &props, + bool *ok) +{ + *ok = true; + + QList > data; + for(int ii = 0; ii < props.count(); ++ii) + compileList(data, QByteArray(), props.at(ii)); + + QByteArray rv; + QDataStream ds(&rv, QIODevice::WriteOnly); + + ds << data.count(); + for(int ii = 0; ii < data.count(); ++ii) { + QmlParser::Variant v = qvariant_cast(data.at(ii).second); + QVariant var; + bool isScript = v.isScript(); + switch(v.type()) { + case QmlParser::Variant::Boolean: + var = QVariant(v.asBoolean()); + break; + case QmlParser::Variant::Number: + var = QVariant(v.asNumber()); + break; + case QmlParser::Variant::String: + var = QVariant(v.asString()); + break; + case QmlParser::Variant::Invalid: + case QmlParser::Variant::Script: + var = QVariant(v.asScript()); + break; + } + + ds << data.at(ii).first << isScript << var; + } + + return rv; +} + +void QmlPropertyChangesPrivate::decode() +{ + Q_Q(QmlPropertyChanges); + if (decoded) + return; + + QDataStream ds(&data, QIODevice::ReadOnly); + + int count; + ds >> count; + for (int ii = 0; ii < count; ++ii) { + QByteArray name; + bool isScript; + QVariant data; + ds >> name; + ds >> isScript; + ds >> data; + + if (isScript) { + QmlExpression *expression = new QmlExpression(qmlContext(q), data.toString(), object); + expression->setTrackChange(false); + expressions << qMakePair(name, expression); + } else { + properties << qMakePair(name, data); + } + } + + decoded = true; + data.clear(); +} + +void QmlPropertyChangesParser::setCustomData(QObject *object, + const QByteArray &data) +{ + QmlPropertyChangesPrivate *p = + static_cast(QObjectPrivate::get(object)); + p->data = data; + p->decoded = false; +} + +QmlPropertyChanges::QmlPropertyChanges() +: QmlStateOperation(*(new QmlPropertyChangesPrivate)) +{ +} + +QmlPropertyChanges::~QmlPropertyChanges() +{ + Q_D(QmlPropertyChanges); + for(int ii = 0; ii < d->expressions.count(); ++ii) + delete d->expressions.at(ii).second; +} + +QObject *QmlPropertyChanges::object() const +{ + Q_D(const QmlPropertyChanges); + return d->object; +} + +void QmlPropertyChanges::setObject(QObject *o) +{ + Q_D(QmlPropertyChanges); + d->object = o; +} + +bool QmlPropertyChanges::restoreEntryValues() const +{ + Q_D(const QmlPropertyChanges); + return d->restore; +} + +void QmlPropertyChanges::setRestoreEntryValues(bool v) +{ + Q_D(QmlPropertyChanges); + d->restore = v; +} + +QmlMetaProperty +QmlPropertyChangesPrivate::property(const QByteArray &property) +{ + Q_Q(QmlPropertyChanges); + QmlMetaProperty prop = QmlMetaProperty::createProperty(object, QString::fromLatin1(property)); + if (!prop.isValid()) { + qmlInfo(q) << "Cannot assign to non-existant property" << property; + return QmlMetaProperty(); + } else if (!prop.isWritable()) { + qmlInfo(q) << "Cannot assign to read-only property" << property; + return QmlMetaProperty(); + } + return prop; +} + +QmlPropertyChanges::ActionList QmlPropertyChanges::actions() +{ + Q_D(QmlPropertyChanges); + + d->decode(); + + ActionList list; + + for (int ii = 0; ii < d->properties.count(); ++ii) { + + QByteArray property = d->properties.at(ii).first; + + Action a(d->object, QString::fromLatin1(property), + d->properties.at(ii).second); + + if (a.property.isValid()) { + a.restore = restoreEntryValues(); + + if (a.property.propertyType() == QVariant::Url && + (a.toValue.type() == QVariant::String || a.toValue.type() == QVariant::ByteArray) && !a.toValue.isNull()) + a.toValue.setValue(qmlContext(this)->resolvedUrl(QUrl(a.toValue.toString()))); //### d->object's context? + + list << a; + } + } + + for (int ii = 0; ii < d->expressions.count(); ++ii) { + + QByteArray property = d->expressions.at(ii).first; + QmlMetaProperty prop = d->property(property); + + if (prop.isValid()) { + Action a; + a.restore = restoreEntryValues(); + a.property = prop; + a.fromValue = a.property.read(); + a.specifiedObject = d->object; + a.specifiedProperty = QString::fromLatin1(property); + + if (d->isExplicit) { + a.toValue = d->expressions.at(ii).second->value(); + } else { + QmlBinding *newBinding = new QmlBinding(d->expressions.at(ii).second->expression(), object(), qmlContext(this)); + newBinding->setTarget(prop); + a.toBinding = newBinding; + a.deletableToBinding = true; + } + + list << a; + } + } + + return list; +} + +bool QmlPropertyChanges::isExplicit() const +{ + Q_D(const QmlPropertyChanges); + return d->isExplicit; +} + +void QmlPropertyChanges::setIsExplicit(bool e) +{ + Q_D(QmlPropertyChanges); + d->isExplicit = e; +} + +QML_DEFINE_CUSTOM_TYPE(Qt, 4,6, (QT_VERSION&0x00ff00)>>8, PropertyChanges, QmlPropertyChanges, QmlPropertyChangesParser) + +QT_END_NAMESPACE diff --git a/src/declarative/util/qmlpropertychanges.h b/src/declarative/util/qmlpropertychanges.h new file mode 100644 index 0000000..8d338f1 --- /dev/null +++ b/src/declarative/util/qmlpropertychanges.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLPROPERTYCHANGES_H +#define QMLPROPERTYCHANGES_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QmlPropertyChangesPrivate; +class Q_DECLARATIVE_EXPORT QmlPropertyChanges : public QmlStateOperation +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QmlPropertyChanges) + + 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: + QmlPropertyChanges(); + ~QmlPropertyChanges(); + + QObject *object() const; + void setObject(QObject *); + + bool restoreEntryValues() const; + void setRestoreEntryValues(bool); + + bool isExplicit() const; + void setIsExplicit(bool); + + virtual ActionList actions(); +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QmlPropertyChanges) + +QT_END_HEADER + +#endif // QMLPROPERTYCHANGES_H diff --git a/src/declarative/util/qmlsetproperties.cpp b/src/declarative/util/qmlsetproperties.cpp deleted file mode 100644 index e7be329..0000000 --- a/src/declarative/util/qmlsetproperties.cpp +++ /dev/null @@ -1,339 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "private/qobject_p.h" -#include "qmlopenmetaobject.h" -#include "qmlsetproperties.h" -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -/*! - \qmlclass SetProperties QmlSetProperties - \brief The SetProperties element describes new property values for a state. - - SetProperties changes the properties of an item. It allows you to specify the property - names and values similar to how you normally would specify them for the actual item: - - \code - SetProperties { - target: myRect - x: 52 - y: 300 - width: 48 - } - \endcode -*/ - -/*! - \internal - \class QmlSetProperties - \brief The QmlSetProperties class describes new property values for a state. -*/ - -/*! - \qmlproperty Object SetProperties::target - This property holds the object that the properties to change belong to -*/ - -class QmlSetPropertiesPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QmlSetProperties) -public: - QmlSetPropertiesPrivate() : object(0), decoded(true), restore(true), - isExplicit(false) {} - - QObject *object; - QByteArray data; - bool decoded; - void decode(); - - bool restore; - bool isExplicit; - - QList > properties; - QList > expressions; - - QmlMetaProperty property(const QByteArray &); -}; - -class QmlSetPropertiesParser : public QmlCustomParser -{ -public: - void compileList(QList > &list, const QByteArray &pre, const QmlCustomParserProperty &prop); - - virtual QByteArray compile(const QList &, bool *ok); - virtual void setCustomData(QObject *, const QByteArray &); -}; - -void -QmlSetPropertiesParser::compileList(QList > &list, - const QByteArray &pre, - const QmlCustomParserProperty &prop) -{ - QByteArray propName = pre + prop.name(); - - QList values = prop.assignedValues(); - for (int ii = 0; ii < values.count(); ++ii) { - const QVariant &value = values.at(ii); - - if (value.userType() == qMetaTypeId()) { - continue; - } else if(value.userType() == qMetaTypeId()) { - - QmlCustomParserProperty prop = - qvariant_cast(value); - QByteArray pre = propName + "."; - compileList(list, pre, prop); - - } else { - list << qMakePair(propName, value); - } - } -} - -QByteArray -QmlSetPropertiesParser::compile(const QList &props, - bool *ok) -{ - *ok = true; - - QList > data; - for(int ii = 0; ii < props.count(); ++ii) - compileList(data, QByteArray(), props.at(ii)); - - QByteArray rv; - QDataStream ds(&rv, QIODevice::WriteOnly); - - ds << data.count(); - for(int ii = 0; ii < data.count(); ++ii) { - QmlParser::Variant v = qvariant_cast(data.at(ii).second); - QVariant var; - bool isScript = v.isScript(); - switch(v.type()) { - case QmlParser::Variant::Boolean: - var = QVariant(v.asBoolean()); - break; - case QmlParser::Variant::Number: - var = QVariant(v.asNumber()); - break; - case QmlParser::Variant::String: - var = QVariant(v.asString()); - break; - case QmlParser::Variant::Invalid: - case QmlParser::Variant::Script: - var = QVariant(v.asScript()); - break; - } - - ds << data.at(ii).first << isScript << var; - } - - return rv; -} - -void QmlSetPropertiesPrivate::decode() -{ - Q_Q(QmlSetProperties); - if (decoded) - return; - - QDataStream ds(&data, QIODevice::ReadOnly); - - int count; - ds >> count; - for (int ii = 0; ii < count; ++ii) { - QByteArray name; - bool isScript; - QVariant data; - ds >> name; - ds >> isScript; - ds >> data; - - if (isScript) { - QmlExpression *expression = new QmlExpression(qmlContext(q), data.toString(), object); - expression->setTrackChange(false); - expressions << qMakePair(name, expression); - } else { - properties << qMakePair(name, data); - } - } - - decoded = true; - data.clear(); -} - -void QmlSetPropertiesParser::setCustomData(QObject *object, - const QByteArray &data) -{ - QmlSetPropertiesPrivate *p = - static_cast(QObjectPrivate::get(object)); - p->data = data; - p->decoded = false; -} - -QmlSetProperties::QmlSetProperties() -: QmlStateOperation(*(new QmlSetPropertiesPrivate)) -{ -} - -QmlSetProperties::~QmlSetProperties() -{ - Q_D(QmlSetProperties); - for(int ii = 0; ii < d->expressions.count(); ++ii) - delete d->expressions.at(ii).second; -} - -QObject *QmlSetProperties::object() const -{ - Q_D(const QmlSetProperties); - return d->object; -} - -void QmlSetProperties::setObject(QObject *o) -{ - Q_D(QmlSetProperties); - d->object = o; -} - -bool QmlSetProperties::restoreEntryValues() const -{ - Q_D(const QmlSetProperties); - return d->restore; -} - -void QmlSetProperties::setRestoreEntryValues(bool v) -{ - Q_D(QmlSetProperties); - d->restore = v; -} - -QmlMetaProperty -QmlSetPropertiesPrivate::property(const QByteArray &property) -{ - Q_Q(QmlSetProperties); - QmlMetaProperty prop = QmlMetaProperty::createProperty(object, QString::fromLatin1(property)); - if (!prop.isValid()) { - qmlInfo(q) << "Cannot assign to non-existant property" << property; - return QmlMetaProperty(); - } else if (!prop.isWritable()) { - qmlInfo(q) << "Cannot assign to read-only property" << property; - return QmlMetaProperty(); - } - return prop; -} - -QmlSetProperties::ActionList QmlSetProperties::actions() -{ - Q_D(QmlSetProperties); - - d->decode(); - - ActionList list; - - for (int ii = 0; ii < d->properties.count(); ++ii) { - - QByteArray property = d->properties.at(ii).first; - - Action a(d->object, QString::fromLatin1(property), - d->properties.at(ii).second); - - if (a.property.isValid()) { - a.restore = restoreEntryValues(); - - if (a.property.propertyType() == QVariant::Url && - (a.toValue.type() == QVariant::String || a.toValue.type() == QVariant::ByteArray) && !a.toValue.isNull()) - a.toValue.setValue(qmlContext(this)->resolvedUrl(QUrl(a.toValue.toString()))); //### d->object's context? - - list << a; - } - } - - for (int ii = 0; ii < d->expressions.count(); ++ii) { - - QByteArray property = d->expressions.at(ii).first; - QmlMetaProperty prop = d->property(property); - - if (prop.isValid()) { - Action a; - a.restore = restoreEntryValues(); - a.property = prop; - a.fromValue = a.property.read(); - a.specifiedObject = d->object; - a.specifiedProperty = QString::fromLatin1(property); - - if (d->isExplicit) { - a.toValue = d->expressions.at(ii).second->value(); - } else { - QmlBinding *newBinding = new QmlBinding(d->expressions.at(ii).second->expression(), object(), qmlContext(this)); - newBinding->setTarget(prop); - a.toBinding = newBinding; - a.deletableToBinding = true; - } - - list << a; - } - } - - 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(Qt, 4,6, (QT_VERSION&0x00ff00)>>8, SetProperties, QmlSetProperties, QmlSetPropertiesParser) - -QT_END_NAMESPACE diff --git a/src/declarative/util/qmlsetproperties.h b/src/declarative/util/qmlsetproperties.h deleted file mode 100644 index 3632816..0000000 --- a/src/declarative/util/qmlsetproperties.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLSETPROPERTIES_H -#define QMLSETPROPERTIES_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QmlSetPropertiesPrivate; -class Q_DECLARATIVE_EXPORT QmlSetProperties : public QmlStateOperation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlSetProperties) - - 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(); - - QObject *object() const; - void setObject(QObject *); - - bool restoreEntryValues() const; - void setRestoreEntryValues(bool); - - bool isExplicit() const; - void setIsExplicit(bool); - - virtual ActionList actions(); -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlSetProperties) - -QT_END_HEADER - -#endif // QMLSETPROPERTIES_H diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index 056912f..b17b80b 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -213,60 +213,60 @@ bool QmlParentChange::override(ActionEvent*other) return false; } -class QmlRunScriptPrivate : public QObjectPrivate +class QmlStateChangeScriptPrivate : public QObjectPrivate { public: - QmlRunScriptPrivate() {} + QmlStateChangeScriptPrivate() {} QString script; QString name; }; /*! - \qmlclass RunScript QmlRunScript - \brief The RunScript element allows you to run a script in a state. + \qmlclass StateChangeScript QmlStateChangeScript + \brief The StateChangeScript element allows you to run a script in a state. */ -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,RunScript,QmlRunScript) -QmlRunScript::QmlRunScript(QObject *parent) -: QmlStateOperation(*(new QmlRunScriptPrivate), parent) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,StateChangeScript,QmlStateChangeScript) +QmlStateChangeScript::QmlStateChangeScript(QObject *parent) +: QmlStateOperation(*(new QmlStateChangeScriptPrivate), parent) { } -QmlRunScript::~QmlRunScript() +QmlStateChangeScript::~QmlStateChangeScript() { } /*! - \qmlproperty string RunScript::script + \qmlproperty string StateChangeScript::script This property holds the script to run when the state is current. */ -QString QmlRunScript::script() const +QString QmlStateChangeScript::script() const { - Q_D(const QmlRunScript); + Q_D(const QmlStateChangeScript); return d->script; } -void QmlRunScript::setScript(const QString &s) +void QmlStateChangeScript::setScript(const QString &s) { - Q_D(QmlRunScript); + Q_D(QmlStateChangeScript); d->script = s; } -QString QmlRunScript::name() const +QString QmlStateChangeScript::name() const { - Q_D(const QmlRunScript); + Q_D(const QmlStateChangeScript); return d->name; } -void QmlRunScript::setName(const QString &n) +void QmlStateChangeScript::setName(const QString &n) { - Q_D(QmlRunScript); + Q_D(QmlStateChangeScript); d->name = n; } -void QmlRunScript::execute() +void QmlStateChangeScript::execute() { - Q_D(QmlRunScript); + Q_D(QmlStateChangeScript); if (!d->script.isEmpty()) { QmlExpression expr(qmlContext(this), d->script, this); expr.setTrackChange(false); @@ -274,7 +274,7 @@ void QmlRunScript::execute() } } -QmlRunScript::ActionList QmlRunScript::actions() +QmlStateChangeScript::ActionList QmlStateChangeScript::actions() { ActionList rv; Action a; @@ -284,16 +284,16 @@ QmlRunScript::ActionList QmlRunScript::actions() } /*! - \qmlclass SetAnchors - \brief The SetAnchors element allows you to change anchors in a state. + \qmlclass AnchorChanges + \brief The AnchorChanges element allows you to change anchors in a state. */ -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,SetAnchors,QmlSetAnchors) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,AnchorChanges,QmlAnchorChanges) -class QmlSetAnchorsPrivate : public QObjectPrivate +class QmlAnchorChangesPrivate : public QObjectPrivate { public: - QmlSetAnchorsPrivate() : target(0) {} + QmlAnchorChangesPrivate() : target(0) {} QString name; QFxItem *target; @@ -313,98 +313,98 @@ public: qreal origHeight; }; -QmlSetAnchors::QmlSetAnchors(QObject *parent) - : QmlStateOperation(*(new QmlSetAnchorsPrivate), parent) +QmlAnchorChanges::QmlAnchorChanges(QObject *parent) + : QmlStateOperation(*(new QmlAnchorChangesPrivate), parent) { } -QmlSetAnchors::~QmlSetAnchors() +QmlAnchorChanges::~QmlAnchorChanges() { } -QmlSetAnchors::ActionList QmlSetAnchors::actions() +QmlAnchorChanges::ActionList QmlAnchorChanges::actions() { Action a; a.event = this; return ActionList() << a; } -QFxItem *QmlSetAnchors::object() const +QFxItem *QmlAnchorChanges::object() const { - Q_D(const QmlSetAnchors); + Q_D(const QmlAnchorChanges); return d->target; } -void QmlSetAnchors::setObject(QFxItem *target) +void QmlAnchorChanges::setObject(QFxItem *target) { - Q_D(QmlSetAnchors); + Q_D(QmlAnchorChanges); d->target = target; } -QString QmlSetAnchors::reset() const +QString QmlAnchorChanges::reset() const { - Q_D(const QmlSetAnchors); + Q_D(const QmlAnchorChanges); return d->resetString; } -void QmlSetAnchors::setReset(const QString &reset) +void QmlAnchorChanges::setReset(const QString &reset) { - Q_D(QmlSetAnchors); + Q_D(QmlAnchorChanges); d->resetString = reset; d->resetList = d->resetString.split(QLatin1Char(',')); } -QFxAnchorLine QmlSetAnchors::left() const +QFxAnchorLine QmlAnchorChanges::left() const { - Q_D(const QmlSetAnchors); + Q_D(const QmlAnchorChanges); return d->left; } -void QmlSetAnchors::setLeft(const QFxAnchorLine &edge) +void QmlAnchorChanges::setLeft(const QFxAnchorLine &edge) { - Q_D(QmlSetAnchors); + Q_D(QmlAnchorChanges); d->left = edge; } -QFxAnchorLine QmlSetAnchors::right() const +QFxAnchorLine QmlAnchorChanges::right() const { - Q_D(const QmlSetAnchors); + Q_D(const QmlAnchorChanges); return d->right; } -void QmlSetAnchors::setRight(const QFxAnchorLine &edge) +void QmlAnchorChanges::setRight(const QFxAnchorLine &edge) { - Q_D(QmlSetAnchors); + Q_D(QmlAnchorChanges); d->right = edge; } -QFxAnchorLine QmlSetAnchors::top() const +QFxAnchorLine QmlAnchorChanges::top() const { - Q_D(const QmlSetAnchors); + Q_D(const QmlAnchorChanges); return d->top; } -void QmlSetAnchors::setTop(const QFxAnchorLine &edge) +void QmlAnchorChanges::setTop(const QFxAnchorLine &edge) { - Q_D(QmlSetAnchors); + Q_D(QmlAnchorChanges); d->top = edge; } -QFxAnchorLine QmlSetAnchors::bottom() const +QFxAnchorLine QmlAnchorChanges::bottom() const { - Q_D(const QmlSetAnchors); + Q_D(const QmlAnchorChanges); return d->bottom; } -void QmlSetAnchors::setBottom(const QFxAnchorLine &edge) +void QmlAnchorChanges::setBottom(const QFxAnchorLine &edge) { - Q_D(QmlSetAnchors); + Q_D(QmlAnchorChanges); d->bottom = edge; } -void QmlSetAnchors::execute() +void QmlAnchorChanges::execute() { - Q_D(QmlSetAnchors); + Q_D(QmlAnchorChanges); if (!d->target) return; @@ -419,14 +419,14 @@ void QmlSetAnchors::execute() d->target->anchors()->setBottom(d->bottom); } -bool QmlSetAnchors::isReversable() +bool QmlAnchorChanges::isReversable() { return true; } -void QmlSetAnchors::reverse() +void QmlAnchorChanges::reverse() { - Q_D(QmlSetAnchors); + Q_D(QmlAnchorChanges); if (!d->target) return; @@ -442,14 +442,14 @@ void QmlSetAnchors::reverse() } -QString QmlSetAnchors::typeName() const +QString QmlAnchorChanges::typeName() const { - return QLatin1String("SetAnchors"); + return QLatin1String("AnchorChanges"); } -QList QmlSetAnchors::extraActions() +QList QmlAnchorChanges::extraActions() { - Q_D(QmlSetAnchors); + Q_D(QmlAnchorChanges); QList extra; //### try to be smarter about which ones we add. @@ -477,14 +477,14 @@ QList QmlSetAnchors::extraActions() return extra; } -bool QmlSetAnchors::changesBindings() +bool QmlAnchorChanges::changesBindings() { return true; } -void QmlSetAnchors::clearForwardBindings() +void QmlAnchorChanges::clearForwardBindings() { - Q_D(QmlSetAnchors); + Q_D(QmlAnchorChanges); d->origLeft = d->target->anchors()->left(); d->origRight = d->target->anchors()->right(); d->origTop = d->target->anchors()->top(); @@ -505,9 +505,9 @@ void QmlSetAnchors::clearForwardBindings() d->target->anchors()->resetBottom(); } -void QmlSetAnchors::clearReverseBindings() +void QmlAnchorChanges::clearReverseBindings() { - Q_D(QmlSetAnchors); + Q_D(QmlAnchorChanges); d->origX = d->target->x(); d->origY = d->target->y(); d->origWidth = d->target->width(); diff --git a/src/declarative/util/qmlstateoperations.h b/src/declarative/util/qmlstateoperations.h index 4bd17a0..3018b44 100644 --- a/src/declarative/util/qmlstateoperations.h +++ b/src/declarative/util/qmlstateoperations.h @@ -79,18 +79,18 @@ public: virtual bool override(ActionEvent*other); }; -class QmlRunScriptPrivate; -class Q_DECLARATIVE_EXPORT QmlRunScript : public QmlStateOperation, public ActionEvent +class QmlStateChangeScriptPrivate; +class Q_DECLARATIVE_EXPORT QmlStateChangeScript : public QmlStateOperation, public ActionEvent { Q_OBJECT - Q_DECLARE_PRIVATE(QmlRunScript) + Q_DECLARE_PRIVATE(QmlStateChangeScript) Q_PROPERTY(QString script READ script WRITE setScript) Q_PROPERTY(QString name READ name WRITE setName) public: - QmlRunScript(QObject *parent=0); - ~QmlRunScript(); + QmlStateChangeScript(QObject *parent=0); + ~QmlStateChangeScript(); virtual ActionList actions(); @@ -103,11 +103,11 @@ public: virtual void execute(); }; -class QmlSetAnchorsPrivate; -class Q_DECLARATIVE_EXPORT QmlSetAnchors : public QmlStateOperation, public ActionEvent +class QmlAnchorChangesPrivate; +class Q_DECLARATIVE_EXPORT QmlAnchorChanges : public QmlStateOperation, public ActionEvent { Q_OBJECT - Q_DECLARE_PRIVATE(QmlSetAnchors) + Q_DECLARE_PRIVATE(QmlAnchorChanges) Q_PROPERTY(QFxItem *target READ object WRITE setObject) Q_PROPERTY(QString reset READ reset WRITE setReset) @@ -117,8 +117,8 @@ class Q_DECLARATIVE_EXPORT QmlSetAnchors : public QmlStateOperation, public Acti Q_PROPERTY(QFxAnchorLine bottom READ bottom WRITE setBottom) public: - QmlSetAnchors(QObject *parent=0); - ~QmlSetAnchors(); + QmlAnchorChanges(QObject *parent=0); + ~QmlAnchorChanges(); virtual ActionList actions(); @@ -153,8 +153,8 @@ public: QT_END_NAMESPACE QML_DECLARE_TYPE(QmlParentChange) -QML_DECLARE_TYPE(QmlRunScript) -QML_DECLARE_TYPE(QmlSetAnchors) +QML_DECLARE_TYPE(QmlStateChangeScript) +QML_DECLARE_TYPE(QmlAnchorChanges) QT_END_HEADER diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri index 1a0d402..f1b599f 100644 --- a/src/declarative/util/util.pri +++ b/src/declarative/util/util.pri @@ -11,7 +11,7 @@ SOURCES += \ util/qmlstate.cpp\ util/qmltransitionmanager.cpp \ util/qmlstateoperations.cpp \ - util/qmlsetproperties.cpp \ + util/qmlpropertychanges.cpp \ util/qmlstategroup.cpp \ util/qmltransition.cpp \ util/qmllistmodel.cpp\ @@ -35,7 +35,7 @@ HEADERS += \ util/qmlfollow.h \ util/qmlstate.h\ util/qmlstateoperations.h \ - util/qmlsetproperties.h \ + util/qmlpropertychanges.h \ util/qmlstate_p.h\ util/qmltransitionmanager_p.h \ util/qmlstategroup.h \ -- cgit v0.12