summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-06-30 00:13:40 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-06-30 00:13:40 (GMT)
commitb405bd2ee0a752ba943b5c9993bb0dccf9ddf2f1 (patch)
tree149b6b4bba66e88a44822b1e2d17d699a08faa4d
parentbce256a8513292ff71e9cb690893cea974b642c9 (diff)
parent6856dd2850245414fb610e651391f5fe141605de (diff)
downloadQt-b405bd2ee0a752ba943b5c9993bb0dccf9ddf2f1.zip
Qt-b405bd2ee0a752ba943b5c9993bb0dccf9ddf2f1.tar.gz
Qt-b405bd2ee0a752ba943b5c9993bb0dccf9ddf2f1.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts: demos/declarative/flickr/content/ImageDetails.qml
-rw-r--r--demos/declarative/calculator/calculator.qml4
-rw-r--r--demos/declarative/contacts/Button.qml9
-rw-r--r--demos/declarative/contacts/ContactField.qml12
-rw-r--r--demos/declarative/contacts/FieldText.qml50
-rw-r--r--demos/declarative/contacts/RemoveButton.qml29
-rw-r--r--demos/declarative/contacts/contacts.qml53
-rw-r--r--demos/declarative/flickr/content/ImageDetails.qml4
-rw-r--r--demos/declarative/flickr/content/Loading.qml2
-rw-r--r--demos/declarative/flickr/content/MediaLineEdit.qml7
-rw-r--r--demos/declarative/flickr/content/ScrollBar.qml2
-rw-r--r--demos/declarative/flickr/content/Star.qml2
-rw-r--r--demos/declarative/flickr/flickr.qml28
-rw-r--r--demos/declarative/flickr/flickr2.qml44
-rw-r--r--demos/declarative/webbrowser/webbrowser.qml94
-rw-r--r--doc/src/declarative/animation.qdoc25
-rw-r--r--doc/src/declarative/elements.qdoc7
-rw-r--r--doc/src/declarative/qmlforcpp.qdoc6
-rw-r--r--doc/src/declarative/tutorial3.qdoc32
-rw-r--r--examples/declarative/animation/animation.qml6
-rw-r--r--examples/declarative/behaviours/test.qml10
-rw-r--r--examples/declarative/easing/easing.qml4
-rw-r--r--examples/declarative/flowview/flickr.qml22
-rw-r--r--examples/declarative/flowview/flowview.qml8
-rw-r--r--examples/declarative/follow/follow.qml4
-rw-r--r--examples/declarative/follow/pong.qml4
-rw-r--r--examples/declarative/listview/highlight.qml6
-rw-r--r--examples/declarative/listview/recipes.qml17
-rw-r--r--examples/declarative/minehunt/minehunt.qml10
-rw-r--r--examples/declarative/scrollbar/display.qml14
-rw-r--r--examples/declarative/slideswitch/Switch.qml10
-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.qml27
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml2
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml27
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml27
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml27
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml27
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml12
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml40
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml27
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml12
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml40
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml27
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml2
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml28
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml28
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml2
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml9
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml12
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml40
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml28
-rw-r--r--examples/declarative/tutorials/helloworld/t3/tutorial3.qml4
-rw-r--r--examples/declarative/velocity/Day.qml2
-rw-r--r--examples/declarative/webview/content/SpinSquare.qml2
-rw-r--r--examples/declarative/xmldata/daringfireball.qml8
-rw-r--r--examples/declarative/xmldata/yahoonews.qml24
-rw-r--r--src/declarative/extra/extra.pri17
-rw-r--r--src/declarative/extra/qbindablemap.cpp (renamed from src/declarative/util/qbindablemap.cpp)0
-rw-r--r--src/declarative/extra/qbindablemap.h (renamed from src/declarative/util/qbindablemap.h)0
-rw-r--r--src/declarative/extra/qfxanimatedimageitem.cpp (renamed from src/declarative/fx/qfxanimatedimageitem.cpp)0
-rw-r--r--src/declarative/extra/qfxanimatedimageitem.h (renamed from src/declarative/fx/qfxanimatedimageitem.h)0
-rw-r--r--src/declarative/extra/qfxanimatedimageitem_p.h (renamed from src/declarative/fx/qfxanimatedimageitem_p.h)2
-rw-r--r--src/declarative/extra/qfxblendedimage.cpp (renamed from src/declarative/fx/qfxblendedimage.cpp)0
-rw-r--r--src/declarative/extra/qfxblendedimage.h (renamed from src/declarative/fx/qfxblendedimage.h)0
-rw-r--r--src/declarative/extra/qfxflowview.cpp (renamed from src/declarative/fx/qfxflowview.cpp)0
-rw-r--r--src/declarative/extra/qfxflowview.h (renamed from src/declarative/fx/qfxflowview.h)0
-rw-r--r--src/declarative/extra/qmlbehaviour.cpp (renamed from src/declarative/util/qmlbehaviour.cpp)2
-rw-r--r--src/declarative/extra/qmlbehaviour.h (renamed from src/declarative/util/qmlbehaviour.h)0
-rw-r--r--src/declarative/extra/qmldatetimeformatter.cpp (renamed from src/declarative/util/qmldatetimeformatter.cpp)0
-rw-r--r--src/declarative/extra/qmldatetimeformatter.h (renamed from src/declarative/util/qmldatetimeformatter.h)0
-rw-r--r--src/declarative/extra/qmlxmllistmodel.cpp115
-rw-r--r--src/declarative/extra/qmlxmllistmodel.h15
-rw-r--r--src/declarative/fx/fx.pri6
-rw-r--r--src/declarative/fx/qfxanchors.cpp18
-rw-r--r--src/declarative/fx/qfxanchors_p.h10
-rw-r--r--src/declarative/fx/qfxflipable.cpp2
-rw-r--r--src/declarative/fx/qfxhighlightfilter.cpp2
-rw-r--r--src/declarative/fx/qfxlayouts.cpp24
-rw-r--r--src/declarative/fx/qfxrect.cpp38
-rw-r--r--src/declarative/fx/qfxrect.h2
-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/qmldom.cpp10
-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.cpp891
-rw-r--r--src/declarative/util/qmlanimation.h170
-rw-r--r--src/declarative/util/qmlanimation_p.h72
-rw-r--r--src/declarative/util/qmlfollow.cpp2
-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--src/declarative/util/util.pri6
-rw-r--r--tests/auto/declarative/animations/animations.pro5
-rw-r--r--tests/auto/declarative/animations/data/badtype1.qml10
-rw-r--r--tests/auto/declarative/animations/data/badtype2.qml10
-rw-r--r--tests/auto/declarative/animations/data/badtype3.qml10
-rw-r--r--tests/auto/declarative/animations/data/badtype4.qml23
-rw-r--r--tests/auto/declarative/animations/data/color.qml10
-rw-r--r--tests/auto/declarative/animations/data/mixedtype1.qml22
-rw-r--r--tests/auto/declarative/animations/data/mixedtype2.qml22
-rw-r--r--tests/auto/declarative/animations/data/number.qml10
-rw-r--r--tests/auto/declarative/animations/tst_animations.cpp82
-rw-r--r--tests/auto/declarative/visual/bindinganimation/bindinganimation.qml12
-rw-r--r--tests/auto/declarative/visual/colorAnimation/colorAnimation.qml10
-rw-r--r--tests/auto/declarative/visual/easing/easing.qml12
-rw-r--r--tests/auto/declarative/visual/flipable/flipable.xml10
-rw-r--r--tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml4
115 files changed, 1324 insertions, 1650 deletions
diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml
index 145435b..2a297ef 100644
--- a/demos/declarative/calculator/calculator.qml
+++ b/demos/declarative/calculator/calculator.qml
@@ -120,8 +120,8 @@ Rect {
transitions: [
Transition {
- NumericAnimation { properties: "x,y,width"; easing: "easeOutBounce"; duration: 500 }
- NumericAnimation { properties: "opacity"; easing: "easeInOutQuad"; duration: 500 }
+ NumberAnimation { properties: "x,y,width"; easing: "easeOutBounce"; duration: 500 }
+ NumberAnimation { properties: "opacity"; easing: "easeInOutQuad"; duration: 500 }
}
]
}
diff --git a/demos/declarative/contacts/Button.qml b/demos/declarative/contacts/Button.qml
index 3b76a13..09af769 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"
}
}
]
@@ -36,6 +35,7 @@ Item {
fromState: "*"
toState: "pressed"
ColorAnimation {
+ property: "color"
duration: 200
}
},
@@ -43,13 +43,14 @@ Item {
fromState: "pressed"
toState: "*"
ColorAnimation {
+ property: "color"
duration: 1000
}
}
]
}
opacity: Behavior {
- NumericAnimation {
+ NumberAnimation {
property: "opacity"
duration: 250
}
diff --git a/demos/declarative/contacts/ContactField.qml b/demos/declarative/contacts/ContactField.qml
index 003e723..765dcbd 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
}
}
]
@@ -51,7 +49,7 @@ Item {
fromState: ""
toState: "*"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "width,rightMargin"
duration: 200
}
diff --git a/demos/declarative/contacts/FieldText.qml b/demos/declarative/contacts/FieldText.qml
index 39e45d4..561e3c3 100644
--- a/demos/declarative/contacts/FieldText.qml
+++ b/demos/declarative/contacts/FieldText.qml
@@ -74,7 +74,7 @@ Rect {
text: fieldText.label
opacity: textEdit.text == '' ? 1 : 0
opacity: Behavior {
- NumericAnimation {
+ NumberAnimation {
property: "opacity"
duration: 250
}
@@ -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
}
}
]
@@ -148,11 +139,12 @@ Rect {
fromState: ""
toState: "*"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,leftMargin,rightMargin"
duration: 200
}
ColorAnimation {
+ property: "color"
duration: 150
}
}
diff --git a/demos/declarative/contacts/RemoveButton.qml b/demos/declarative/contacts/RemoveButton.qml
index 8f46fcb..549c97a 100644
--- a/demos/declarative/contacts/RemoveButton.qml
+++ b/demos/declarative/contacts/RemoveButton.qml
@@ -77,7 +77,7 @@ Rect {
opacity: 0
}
opacity: Behavior {
- NumericAnimation {
+ NumberAnimation {
property: "opacity"
duration: 250
}
@@ -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
}
}
]
@@ -117,7 +112,7 @@ Rect {
fromState: "*"
toState: "opened"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,x,width"
duration: 200
}
diff --git a/demos/declarative/contacts/contacts.qml b/demos/declarative/contacts/contacts.qml
index 0ce9948..e773221 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,36 +93,31 @@ 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
}
}
]
transitions: [
Transition {
- NumericAnimation {
+ NumberAnimation {
duration: 500
properties: "yPosition,height,opacity"
}
@@ -221,7 +215,7 @@ Rect {
color: 'white'
opacity: contacts.mode == 'list' ? 1 : 0
opacity: Behavior {
- NumericAnimation {
+ NumberAnimation {
property: "opacity"
duration: 250
}
@@ -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
}
}
]
@@ -288,7 +281,7 @@ Rect {
Transition {
fromState: "*"
toState: "*"
- NumericAnimation {
+ NumberAnimation {
property: "bottomMargin"
duration: 250
}
@@ -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
}
}
]
@@ -319,7 +310,7 @@ Rect {
Transition {
fromState: "*"
toState: "*"
- NumericAnimation {
+ NumberAnimation {
property: "opacity"
duration: 500
}
diff --git a/demos/declarative/flickr/content/ImageDetails.qml b/demos/declarative/flickr/content/ImageDetails.qml
index ed60d17..c57f083 100644
--- a/demos/declarative/flickr/content/ImageDetails.qml
+++ b/demos/declarative/flickr/content/ImageDetails.qml
@@ -130,7 +130,7 @@ Flipable {
states: [
State {
name: "Back"
- SetProperty { target: Container; property: "rotation"; value: 180 }
+ SetProperties { target: Container; rotation: 180 }
}
]
@@ -142,7 +142,7 @@ Flipable {
property: "smooth"
value: false
}
- NumericAnimation { easing: "easeInOutQuad"; properties: "rotation"; duration: 500 }
+ NumberAnimation { easing: "easeInOutQuad"; properties: "rotation"; duration: 500 }
SetPropertyAction {
target: BigImage
property: "smooth"
diff --git a/demos/declarative/flickr/content/Loading.qml b/demos/declarative/flickr/content/Loading.qml
index 7488a66..0a8a51a 100644
--- a/demos/declarative/flickr/content/Loading.qml
+++ b/demos/declarative/flickr/content/Loading.qml
@@ -1,6 +1,6 @@
Image {
id: Loading; source: "pics/loading.png"; transformOrigin: "Center"
- rotation: NumericAnimation {
+ rotation: NumberAnimation {
id: "RotationAnimation"; from: 0; to: 360; running: Loading.visible == true; repeat: true; duration: 900
}
}
diff --git a/demos/declarative/flickr/content/MediaLineEdit.qml b/demos/declarative/flickr/content/MediaLineEdit.qml
index 691bb5b..4f6fed1 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
@@ -41,7 +40,7 @@ Item {
]
transitions: [
Transition {
- NumericAnimation { properties: "x,width"; duration: 500; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,width"; duration: 500; easing: "easeInOutQuad" }
}
]
diff --git a/demos/declarative/flickr/content/ScrollBar.qml b/demos/declarative/flickr/content/ScrollBar.qml
index 2c4ff54..551f0ea 100644
--- a/demos/declarative/flickr/content/ScrollBar.qml
+++ b/demos/declarative/flickr/content/ScrollBar.qml
@@ -28,7 +28,7 @@ Item {
Transition {
fromState: "*"
toState: "*"
- NumericAnimation {
+ NumberAnimation {
target: Container
properties: "opacity"
duration: 400
diff --git a/demos/declarative/flickr/content/Star.qml b/demos/declarative/flickr/content/Star.qml
index 22fc138..437450d 100644
--- a/demos/declarative/flickr/content/Star.qml
+++ b/demos/declarative/flickr/content/Star.qml
@@ -35,7 +35,7 @@ Item {
]
transitions: [
Transition {
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,scale,x,y"
easing: "easeOutBounce"
}
diff --git a/demos/declarative/flickr/flickr.qml b/demos/declarative/flickr/flickr.qml
index 83448ee..edf1095 100644
--- a/demos/declarative/flickr/flickr.qml
+++ b/demos/declarative/flickr/flickr.qml
@@ -10,19 +10,19 @@ Item {
id: FeedModel
property string tags : TagsEdit.text
source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+tags+"&" : "")+"format=rss2"
- query: "doc($src)/rss/channel/item"
+ query: "/rss/channel/item"
namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
- Role { name: "title"; query: "title/string()" }
- Role { name: "imagePath"; query: "media:thumbnail/@url/string()" }
- Role { name: "url"; query: "media:content/@url/string()" }
- Role { name: "description"; query: "description/string()" }
- Role { name: "tags"; query: "media:category/string()" }
- Role { name: "photoWidth"; query: "media:content/@width/string()" }
- Role { name: "photoHeight"; query: "media:content/@height/string()" }
- Role { name: "photoType"; query: "media:content/@type/string()" }
- Role { name: "photoAuthor"; query: "author/string()" }
- Role { name: "photoDate"; query: "pubDate/string()" }
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "imagePath"; query: "media:thumbnail/@url/string()" }
+ XmlRole { name: "url"; query: "media:content/@url/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ XmlRole { name: "tags"; query: "media:category/string()" }
+ XmlRole { name: "photoWidth"; query: "media:content/@width/string()" }
+ XmlRole { name: "photoHeight"; query: "media:content/@height/string()" }
+ XmlRole { name: "photoType"; query: "media:content/@type/string()" }
+ XmlRole { name: "photoAuthor"; query: "author/string()" }
+ XmlRole { name: "photoDate"; query: "pubDate/string()" }
},
Component {
@@ -99,13 +99,13 @@ Item {
Transition {
fromState: "*"; toState: "Details"
ParentChangeAction { }
- NumericAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" }
},
Transition {
fromState: "Details"; toState: "*"
SequentialAnimation {
ParentChangeAction { }
- NumericAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" }
SetPropertyAction { filter: Wrapper; properties: "z" }
}
}
@@ -194,7 +194,7 @@ Item {
transitions: [
Transition {
fromState: "*"; toState: "*"
- NumericAnimation { properties: "y"; duration: 1000; easing: "easeOutBounce(amplitude:0.5)" }
+ NumberAnimation { properties: "y"; duration: 1000; easing: "easeOutBounce(amplitude:0.5)" }
}
]
}
diff --git a/demos/declarative/flickr/flickr2.qml b/demos/declarative/flickr/flickr2.qml
index 79f7a32..d6d5c95 100644
--- a/demos/declarative/flickr/flickr2.qml
+++ b/demos/declarative/flickr/flickr2.qml
@@ -12,19 +12,19 @@ Item {
id: FeedModel
property string tags : TagsEdit.text
source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+tags+"&" : "")+"format=rss2"
- query: "doc($src)/rss/channel/item"
+ query: "/rss/channel/item"
namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
- Role { name: "title"; query: "title/string()" }
- Role { name: "imagePath"; query: "media:thumbnail/@url/string()" }
- Role { name: "url"; query: "media:content/@url/string()" }
- Role { name: "description"; query: "description/string()" }
- Role { name: "tags"; query: "media:category/string()" }
- Role { name: "photoWidth"; query: "media:content/@width/string()" }
- Role { name: "photoHeight"; query: "media:content/@height/string()" }
- Role { name: "photoType"; query: "media:content/@type/string()" }
- Role { name: "photoAuthor"; query: "author/string()" }
- Role { name: "photoDate"; query: "pubDate/string()" }
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "imagePath"; query: "media:thumbnail/@url/string()" }
+ XmlRole { name: "url"; query: "media:content/@url/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ XmlRole { name: "tags"; query: "media:category/string()" }
+ XmlRole { name: "photoWidth"; query: "media:content/@width/string()" }
+ XmlRole { name: "photoHeight"; query: "media:content/@height/string()" }
+ XmlRole { name: "photoType"; query: "media:content/@type/string()" }
+ XmlRole { name: "photoAuthor"; query: "author/string()" }
+ XmlRole { name: "photoDate"; query: "pubDate/string()" }
}
delegate: Package {
@@ -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;
@@ -100,13 +99,13 @@ Item {
Transition {
fromState: "*"; toState: "Details"
ParentChangeAction { }
- NumericAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" }
},
Transition {
fromState: "Details"; toState: "*"
SequentialAnimation {
ParentChangeAction { }
- NumericAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" }
SetPropertyAction { filter: Wrapper; properties: "z" }
}
}
@@ -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: [
@@ -146,14 +142,14 @@ Item {
SequentialAnimation {
SetPropertyAction { target: Wrapper; property: "moveToParent" }
ParallelAnimation {
- NumericAnimation {
+ NumberAnimation {
target: Wrapper
properties: "x,y"
to: 0
easing: "easeOutQuad"
duration: 350
}
- NumericAnimation { target: Wrapper; properties: "scale,angle"; duration: 350 }
+ NumberAnimation { target: Wrapper; properties: "scale,angle"; duration: 350 }
}
}
},
@@ -163,14 +159,14 @@ Item {
PauseAnimation { duration: Math.floor(index/7)*100 }
SetPropertyAction { target: Wrapper; property: "moveToParent" }
ParallelAnimation {
- NumericAnimation {
+ NumberAnimation {
target: Wrapper
properties: "x,y"
to: 0
easing: "easeOutQuad"
duration: 250
}
- NumericAnimation { target: Wrapper; properties: "scale,angle"; duration: 250 }
+ NumberAnimation { target: Wrapper; properties: "scale,angle"; duration: 250 }
}
}
}
diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml
index 889ab87..4c6a177 100644
--- a/demos/declarative/webbrowser/webbrowser.qml
+++ b/demos/declarative/webbrowser/webbrowser.qml
@@ -151,25 +151,17 @@ 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: [
Transition {
- NumericAnimation {
+ NumberAnimation {
target: Header
properties: "progressOff"
easing: "easeInOutQuad"
@@ -255,35 +247,19 @@ 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: [
Transition {
- NumericAnimation {
+ NumberAnimation {
properties: "opacity"
easing: "easeInOutQuad"
duration: 300
@@ -327,35 +303,19 @@ 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: [
Transition {
- NumericAnimation {
+ NumberAnimation {
properties: "opacity"
easing: "easeInOutQuad"
duration: 320
@@ -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: [
@@ -406,13 +350,13 @@ Item {
value: false
}
ParallelAnimation {
- NumericAnimation {
+ NumberAnimation {
target: WebView
properties: "zoomedOut"
easing: "easeInOutQuad"
duration: 200
}
- NumericAnimation {
+ NumberAnimation {
target: Flick
properties: "xPosition,yPosition"
easing: "easeInOutQuad"
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc
index f17f5c9..57881a8 100644
--- a/doc/src/declarative/animation.qdoc
+++ b/doc/src/declarative/animation.qdoc
@@ -25,7 +25,7 @@ Other Features:
\o Animation synchronization
\endlist
-The simplest form of animation is using \l NumericAnimation
+The simplest form of animation is using \l NumberAnimation
The following example creates a bouncing effect:
\code
@@ -40,9 +40,9 @@ Rect {
y: SequentialAnimation {
running: true
repeat: true
- NumericAnimation { to: 200-img.height; easing: "easeOutBounce"; duration: 2000 }
+ NumberAnimation { to: 200-img.height; easing: "easeOutBounce"; duration: 2000 }
PauseAnimation { duration: 1000 }
- NumericAnimation { to: 0; easing: "easeOutQuad"; duration: 1000 }
+ NumberAnimation { to: 0; easing: "easeOutQuad"; duration: 1000 }
}
}
}
@@ -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
}
}
]
@@ -113,7 +111,7 @@ For the previous example, a transition could describe how \c myrect moved from i
\code
transitions: [
Transition {
- NumericAnimation {
+ NumberAnimation {
properties: "x,y"
easing: "easeOutBounce"
duration: 200
@@ -132,7 +130,7 @@ Transition {
}
\endcode
-Transitions can happen in parallel, in sequence, or in any combination of the two:;
+Transitions can happen in parallel, in sequence, or in any combination of the two:
\code
Transition {
@@ -141,19 +139,20 @@ Transition {
reversible: true
SequentialAnimation {
ColorAnimation {
+ property: "color"
duration: 1000
}
PauseAnimation {
duration: 1000
}
ParallelAnimation {
- NumericAnimation {
+ NumberAnimation {
duration: 1000
easing: "easeOutBounce"
target: box1
properties: "x,y"
}
- NumericAnimation {
+ NumberAnimation {
duration: 1000
target: box2
properties: "x,y"
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index 35d746b..63566f6 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
@@ -26,9 +25,9 @@ The following table lists the Qml elements provided by the Qt Declarative module
\o
\list
-\o \l NumericAnimation
+\o \l PropertyAnimation
+\o \l NumberAnimation
\o \l ColorAnimation
-\o \l VariantAnimation
\o \l PauseAnimation
\o \l SequentialAnimation
\o \l ParallelAnimation
@@ -43,7 +42,7 @@ The following table lists the Qml elements provided by the Qt Declarative module
\list
\o \l Bind
\o \l ListModel
-\o \l XmlListModel
+\o \l XmlListModel and XmlRole
\o \l SqlQuery, \l SqlConnection, and \l SqlBind
\o \l DateTimeFormatter
\o \l NumberFormatter
diff --git a/doc/src/declarative/qmlforcpp.qdoc b/doc/src/declarative/qmlforcpp.qdoc
index 4095071..c95cb71 100644
--- a/doc/src/declarative/qmlforcpp.qdoc
+++ b/doc/src/declarative/qmlforcpp.qdoc
@@ -438,7 +438,7 @@
\code
Button {
id: MyButton
- onClicked: NumericAnimation {
+ onClicked: NumberAnimation {
target: MyButton
property: "x"
to: 100
@@ -555,12 +555,12 @@
\code
Rect {
- x: NumericAnimation { running: true; repeat; true; from: 0; to: 100; }
+ x: NumberAnimation { running: true; repeat; true; from: 0; to: 100; }
}
\endcode
Here the \c x property of the rectangle will be animated from 0 to 100.
- To support this, the NumericAnimation class inherits the
+ To support this, the NumberAnimation class inherits the
QmlPropertyValueSource class. If a type inherits this class and is assigned
to a property for which type assignment would otherwise fail (ie. the
property itself doesn't have a type of QmlPropertyValueSource *), the QML
diff --git a/doc/src/declarative/tutorial3.qdoc b/doc/src/declarative/tutorial3.qdoc
index 0b97e63..9ae56c1 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: [
@@ -46,12 +38,12 @@ Rect {
toState: "down"
reversible: true
ParallelAnimation {
- NumericAnimation {
+ NumberAnimation {
properties: "y"
duration: 500
easing: "easeOutBounce"
}
- ColorAnimation { duration: 500 }
+ ColorAnimation { property: "color"; duration: 500 }
}
}
]
@@ -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
@@ -114,12 +98,12 @@ Because we want the same transition to be run in reverse when changing back from
\code
ParallelAnimation {
- NumericAnimation {
+ NumberAnimation {
properties: "y"
duration: 500
easing: "easeOutBounce"
}
- ColorAnimation { duration: 500 }
+ ColorAnimation { property: "color"; duration: 500 }
}
\endcode
diff --git a/examples/declarative/animation/animation.qml b/examples/declarative/animation/animation.qml
index 5cb471e..37e68d6 100644
--- a/examples/declarative/animation/animation.qml
+++ b/examples/declarative/animation/animation.qml
@@ -14,7 +14,7 @@ Rect {
running: true
repeat: true
// Move from 0 to 360 in 500ms, using the easeInOutQuad easing function
- NumericAnimation {
+ NumberAnimation {
from: 0
to: 360
easing: "easeInOutQuad"
@@ -25,7 +25,7 @@ Rect {
duration: 200
}
// Then move back to 0 in 2 seconds, using the easeInOutElastic easing function
- NumericAnimation {
+ NumberAnimation {
from: 360
to: 0
easing: "easeInOutElastic"
@@ -37,11 +37,13 @@ Rect {
running: true
repeat: true
ColorAnimation {
+ property: "color"
from: "#FF0000"
to: "#00FF00"
duration: 5000
}
ColorAnimation {
+ property: "color"
from: "#00FF00"
to: "#FF0000"
duration: 5000
diff --git a/examples/declarative/behaviours/test.qml b/examples/declarative/behaviours/test.qml
index e6a50cd..4c092bf 100644
--- a/examples/declarative/behaviours/test.qml
+++ b/examples/declarative/behaviours/test.qml
@@ -56,7 +56,7 @@ Rect {
id: bluerect
x: Behavior {
SequentialAnimation {
- NumericAnimation {
+ NumberAnimation {
target: bluerect
properties: "y"
from: 0
@@ -64,7 +64,7 @@ Rect {
easing: "easeOutBounce(amplitude:30)"
duration: 250
}
- NumericAnimation {
+ NumberAnimation {
target: bluerect
properties: "y"
from: 10
@@ -73,18 +73,18 @@ Rect {
duration: 250
}
}
- NumericAnimation { duration: 500 }
+ NumberAnimation { duration: 500 }
}
parent: Behavior {
SequentialAnimation {
- NumericAnimation {
+ NumberAnimation {
target: bluerect
properties: "opacity"
to: 0
duration: 150
}
SetPropertyAction {}
- NumericAnimation {
+ NumberAnimation {
target: bluerect
properties: "opacity"
to: 1
diff --git a/examples/declarative/easing/easing.qml b/examples/declarative/easing/easing.qml
index af675d1..4fdf512 100644
--- a/examples/declarative/easing/easing.qml
+++ b/examples/declarative/easing/easing.qml
@@ -63,7 +63,7 @@ Rect {
font.italic: true
x: SequentialAnimation {
id: Anim
- NumericAnimation {
+ NumberAnimation {
from: 0
to: Window.width / 2
easing: type
@@ -72,7 +72,7 @@ Rect {
PauseAnimation {
duration: 300
}
- NumericAnimation {
+ NumberAnimation {
to: 0
from: Window.width / 2
easing: type
diff --git a/examples/declarative/flowview/flickr.qml b/examples/declarative/flowview/flickr.qml
index fa8233b..2742839 100644
--- a/examples/declarative/flowview/flickr.qml
+++ b/examples/declarative/flowview/flickr.qml
@@ -8,19 +8,19 @@ Rect {
XmlListModel {
id: FeedModel
source: "http://api.flickr.com/services/feeds/photos_public.gne?format=rss2"
- query: "doc($src)/rss/channel/item"
+ query: "/rss/channel/item"
namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
- Role { name: "title"; query: "title/string()" }
- Role { name: "imagePath"; query: "media:thumbnail/@url/string()" }
- Role { name: "url"; query: "media:content/@url/string()" }
- Role { name: "description"; query: "description/string()" }
- Role { name: "tags"; query: "media:category/string()" }
- Role { name: "photoWidth"; query: "media:content/@width/string()" }
- Role { name: "photoHeight"; query: "media:content/@height/string()" }
- Role { name: "photoType"; query: "media:content/@type/string()" }
- Role { name: "photoAuthor"; query: "author/string()" }
- Role { name: "photoDate"; query: "pubDate/string()" }
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "imagePath"; query: "media:thumbnail/@url/string()" }
+ XmlRole { name: "url"; query: "media:content/@url/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ XmlRole { name: "tags"; query: "media:category/string()" }
+ XmlRole { name: "photoWidth"; query: "media:content/@width/string()" }
+ XmlRole { name: "photoHeight"; query: "media:content/@height/string()" }
+ XmlRole { name: "photoType"; query: "media:content/@type/string()" }
+ XmlRole { name: "photoAuthor"; query: "author/string()" }
+ XmlRole { name: "photoDate"; query: "pubDate/string()" }
}
ListView {
diff --git a/examples/declarative/flowview/flowview.qml b/examples/declarative/flowview/flowview.qml
index 4c9aecc..61b8794 100644
--- a/examples/declarative/flowview/flowview.qml
+++ b/examples/declarative/flowview/flowview.qml
@@ -23,8 +23,8 @@ Rect {
fromState: "" ; toState: "rotated"
reversible: true
SequentialAnimation {
- NumericAnimation { filter: [TopBar, BottomBar]; properties: "x,y"; easing: "easeInOutQuad" }
- NumericAnimation { filter: [LeftBar, RightBar]; properties: "x,y"; easing: "easeInOutQuad"}
+ NumberAnimation { filter: [TopBar, BottomBar]; properties: "x,y"; easing: "easeInOutQuad" }
+ NumberAnimation { filter: [LeftBar, RightBar]; properties: "x,y"; easing: "easeInOutQuad"}
}
}
@@ -66,7 +66,7 @@ Rect {
SequentialAnimation {
ParentChangeAction{}
PauseAnimation { duration: 50 * List.FlowView.column }
- NumericAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" }
}
},
Transition {
@@ -74,7 +74,7 @@ Rect {
SequentialAnimation {
ParentChangeAction{}
PauseAnimation { duration: 50 * (Grid.FlowView.row * 2 + Grid.FlowView.column) }
- NumericAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" }
}
}
]
diff --git a/examples/declarative/follow/follow.qml b/examples/declarative/follow/follow.qml
index 3258ea6..21a0309 100644
--- a/examples/declarative/follow/follow.qml
+++ b/examples/declarative/follow/follow.qml
@@ -7,11 +7,11 @@ Rect {
y: 200; width: 60; height: 20
y: SequentialAnimation {
running: true; repeat: true
- NumericAnimation {
+ NumberAnimation {
to: 20; duration: 500
easing: "easeInOutQuad"
}
- NumericAnimation {
+ NumberAnimation {
to: 200; duration: 2000
easing: "easeOutBounce"
}
diff --git a/examples/declarative/follow/pong.qml b/examples/declarative/follow/pong.qml
index 582b04c..93ee6a7 100644
--- a/examples/declarative/follow/pong.qml
+++ b/examples/declarative/follow/pong.qml
@@ -16,9 +16,9 @@ Rect {
// Move the ball to the right and back to the left repeatedly
x: SequentialAnimation {
running: true; repeat: true
- NumericAnimation { to: Page.width-40; duration: 2000 }
+ NumberAnimation { to: Page.width-40; duration: 2000 }
SetPropertyAction { target: Ball; property: "direction"; value: "left" }
- NumericAnimation { to: 20; duration: 2000 }
+ NumberAnimation { to: 20; duration: 2000 }
SetPropertyAction { target: Ball; property: "direction"; value: "right" }
}
diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml
index 9a672d9..11230e1 100644
--- a/examples/declarative/listview/highlight.qml
+++ b/examples/declarative/listview/highlight.qml
@@ -23,14 +23,12 @@ Rect {
State {
name: "Current"
when: Wrapper.ListView.isCurrentItem
- SetProperty {
- target: Wrapper; property: "x"; value: 10
- }
+ SetProperties { target: Wrapper; x: 10 }
}
]
transitions: [
Transition {
- NumericAnimation {
+ NumberAnimation {
properties: "x"; duration: 200
}
}
diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml
index ae9756c..6536b06 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,28 +94,25 @@ 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: [
Transition {
// Make the state changes smooth
ParallelAnimation {
- ColorAnimation { duration: 500 }
- NumericAnimation {
+ ColorAnimation { property: "color"; duration: 500 }
+ NumberAnimation {
duration: 300; properties: "detailsOpacity,x,yPosition,height,width"
}
}
diff --git a/examples/declarative/minehunt/minehunt.qml b/examples/declarative/minehunt/minehunt.qml
index db826a3..03fcc8d 100644
--- a/examples/declarative/minehunt/minehunt.qml
+++ b/examples/declarative/minehunt/minehunt.qml
@@ -29,7 +29,7 @@ Item {
source: "pics/flag.png"
opacity: modelData.hasFlag
opacity: Behavior {
- NumericAnimation {
+ NumberAnimation {
property: "opacity"
duration: 250
}
@@ -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: [
@@ -77,7 +73,7 @@ Item {
PauseAnimation {
duration: {var ret = Math.abs(flipable.parent.x-field.clickx) + Math.abs(flipable.parent.y-field.clicky); if (ret > 0) {if(modelData.hasMine==true && modelData.flipped==true){ret*3;}else{ret;}} else {0}}
}
- NumericAnimation {
+ NumberAnimation {
easing: "easeInOutQuad"
properties: "rotation"
}
diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml
index 42e8f25..ae28ef1 100644
--- a/examples/declarative/scrollbar/display.qml
+++ b/examples/declarative/scrollbar/display.qml
@@ -16,23 +16,15 @@ 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: [
Transition {
fromState: "*"
toState: "*"
- NumericAnimation {
+ NumberAnimation {
properties: "opacity"
duration: 400
}
diff --git a/examples/declarative/slideswitch/Switch.qml b/examples/declarative/slideswitch/Switch.qml
index 8bc88e4..e0c2dd9 100644
--- a/examples/declarative/slideswitch/Switch.qml
+++ b/examples/declarative/slideswitch/Switch.qml
@@ -39,18 +39,18 @@ 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: [
Transition {
- NumericAnimation { properties: "x"; easing: "easeInOutQuad"; duration: 200 }
+ NumberAnimation { properties: "x"; easing: "easeInOutQuad"; duration: 200 }
}
]
}
diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml
index 736cc87..1a719ed 100644
--- a/examples/declarative/states/transitions.qml
+++ b/examples/declarative/states/transitions.qml
@@ -50,17 +50,17 @@ Rect {
// with easeOutBounce easing function.
Transition {
fromState: "*"; toState: "Position1"
- NumericAnimation { properties: "x,y"; easing: "easeOutBounce"; duration: 1000 }
+ NumberAnimation { properties: "x,y"; easing: "easeOutBounce"; duration: 1000 }
},
// When transitioning to 'Position2' move x,y over a duration of 2 seconds,
// with easeInOutQuad easing function.
Transition {
fromState: "*"; toState: "Position2"
- NumericAnimation { properties: "x,y"; easing: "easeInOutQuad"; duration: 2000 }
+ NumberAnimation { properties: "x,y"; easing: "easeInOutQuad"; duration: 2000 }
},
// For any other state changes move x,y linearly over duration of 200ms.
Transition {
- NumericAnimation { properties: "x,y"; duration: 200 }
+ NumberAnimation { properties: "x,y"; duration: 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..58662d1 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
}
}
]
@@ -107,7 +102,7 @@ Rect {
fromState: "*"
toState: "opened"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,x,width"
duration: 200
}
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml
index 0d607a9..064aaa2 100644
--- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml
+++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml
@@ -48,7 +48,7 @@ FocusRealm {
onClicked: { parent.parent.focus=true }
}
opacity: Behavior {
- NumericAnimation {
+ NumberAnimation {
property: "opacity"
duration: 250
}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml
index 3142c45..a0f3880 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
}
}
]
@@ -106,7 +101,7 @@ Rect {
fromState: "*"
toState: "opened"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,x,width"
duration: 200
}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml
index 3142c45..a0f3880 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
}
}
]
@@ -106,7 +101,7 @@ Rect {
fromState: "*"
toState: "opened"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,x,width"
duration: 200
}
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..7baa8af 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
}
}
]
@@ -108,7 +103,7 @@ Rect {
fromState: "*"
toState: "opened"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,x,width"
duration: 200
}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml
index 99a521d..55a13a1 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
}
}
]
@@ -114,7 +109,7 @@ Rect {
fromState: "*"
toState: "opened"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,x,width"
duration: 200
}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml
index 890d781..cdbcd13 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
}
}
]
@@ -51,7 +49,7 @@ Item {
fromState: ""
toState: "*"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "width,rightMargin"
duration: 200
}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml
index 8bf5317..353e440 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml
@@ -71,7 +71,7 @@ Rect {
text: fieldText.label
opacity: textEdit.text == '' ? 1 : 0
opacity: Behavior {
- NumericAnimation {
+ NumberAnimation {
property: "opacity"
duration: 250
}
@@ -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
}
}
]
@@ -136,11 +129,12 @@ Rect {
fromState: ""
toState: "*"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,leftMargin,rightMargin"
duration: 200
}
ColorAnimation {
+ property: "color"
duration: 150
}
}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml
index 2f27a69..a9bf3ee 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
}
}
]
@@ -109,7 +104,7 @@ Rect {
fromState: "*"
toState: "opened"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,x,width"
duration: 200
}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml
index e9927e9..4cd74a7 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
}
}
]
@@ -49,7 +47,7 @@ Item {
fromState: ""
toState: "*"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "width,rightMargin"
duration: 200
}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml
index d4fbc20..cb2c368 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml
@@ -73,7 +73,7 @@ Rect {
text: fieldText.label
opacity: textEdit.text == '' ? 1 : 0
opacity: Behavior {
- NumericAnimation {
+ NumberAnimation {
property: "opacity"
duration: 250
}
@@ -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
}
}
]
@@ -137,11 +130,12 @@ Rect {
fromState: ""
toState: "*"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,leftMargin,rightMargin"
duration: 200
}
ColorAnimation {
+ property: "color"
duration: 150
}
}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml
index bfe496e..05146b7 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
}
}
]
@@ -114,7 +109,7 @@ Rect {
fromState: "*"
toState: "opened"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,x,width"
duration: 200
}
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml b/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml
index 0d607a9..064aaa2 100644
--- a/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml
+++ b/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml
@@ -48,7 +48,7 @@ FocusRealm {
onClicked: { parent.parent.focus=true }
}
opacity: Behavior {
- NumericAnimation {
+ NumberAnimation {
property: "opacity"
duration: 250
}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml
index 0a293f5..120c7ba 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
}
}
]
@@ -102,7 +98,7 @@ Item {
//! [transitions]
transitions: [
Transition {
- NumericAnimation {
+ NumberAnimation {
duration: 500
properties: "yPosition,height,opacity"
}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml
index 7a44a3f..82b55af 100644
--- a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml
+++ b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml
@@ -89,36 +89,32 @@ 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
}
}
]
transitions: [
Transition {
- NumericAnimation {
+ NumberAnimation {
duration: 500
properties: "yPosition,height,opacity"
}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml b/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml
index 0d607a9..064aaa2 100644
--- a/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml
+++ b/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml
@@ -48,7 +48,7 @@ FocusRealm {
onClicked: { parent.parent.focus=true }
}
opacity: Behavior {
- NumericAnimation {
+ NumberAnimation {
property: "opacity"
duration: 250
}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml
index 3b76a13..09af769 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"
}
}
]
@@ -36,6 +35,7 @@ Item {
fromState: "*"
toState: "pressed"
ColorAnimation {
+ property: "color"
duration: 200
}
},
@@ -43,13 +43,14 @@ Item {
fromState: "pressed"
toState: "*"
ColorAnimation {
+ property: "color"
duration: 1000
}
}
]
}
opacity: Behavior {
- NumericAnimation {
+ NumberAnimation {
property: "opacity"
duration: 250
}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml
index e9927e9..4cd74a7 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
}
}
]
@@ -49,7 +47,7 @@ Item {
fromState: ""
toState: "*"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "width,rightMargin"
duration: 200
}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml
index 111d9c5..417c08a 100644
--- a/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml
+++ b/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml
@@ -73,7 +73,7 @@ Rect {
text: fieldText.label
opacity: textEdit.text == '' ? 1 : 0
opacity: Behavior {
- NumericAnimation {
+ NumberAnimation {
property: "opacity"
duration: 250
}
@@ -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
}
}
]
@@ -137,11 +130,12 @@ Rect {
fromState: ""
toState: "*"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,leftMargin,rightMargin"
duration: 200
}
ColorAnimation {
+ property: "color"
duration: 150
}
}
diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml
index c0ea79d..a962eb3 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
}
}
]
@@ -112,7 +108,7 @@ Rect {
fromState: "*"
toState: "opened"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "opacity,x,width"
duration: 200
}
diff --git a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
index 127d99e..664bf45 100644
--- a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
+++ b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
@@ -27,12 +27,12 @@ Rect {
toState: "down"
reversible: true
ParallelAnimation {
- NumericAnimation {
+ NumberAnimation {
properties: "y"
duration: 500
easing: "easeOutBounce"
}
- ColorAnimation { duration: 500 }
+ ColorAnimation { property: "color"; duration: 500 }
}
}
]
diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml
index c70a211..8f78822 100644
--- a/examples/declarative/velocity/Day.qml
+++ b/examples/declarative/velocity/Day.qml
@@ -100,7 +100,7 @@ Rect {
]
transitions: [
Transition {
- NumericAnimation {
+ NumberAnimation {
properties: "rotation,scale"
duration: 200
}
diff --git a/examples/declarative/webview/content/SpinSquare.qml b/examples/declarative/webview/content/SpinSquare.qml
index 5e4735e..640416f 100644
--- a/examples/declarative/webview/content/SpinSquare.qml
+++ b/examples/declarative/webview/content/SpinSquare.qml
@@ -13,7 +13,7 @@ Item {
width: Root.width
height: width
}
- rotation: NumericAnimation {
+ rotation: NumberAnimation {
from: 0
to: 360
repeat: true
diff --git a/examples/declarative/xmldata/daringfireball.qml b/examples/declarative/xmldata/daringfireball.qml
index b14dfbf..6f3461e 100644
--- a/examples/declarative/xmldata/daringfireball.qml
+++ b/examples/declarative/xmldata/daringfireball.qml
@@ -6,17 +6,17 @@ Rect {
XmlListModel {
id: feedModel
source: "http://daringfireball.net/index.xml"
- query: "doc($src)/feed/entry"
+ query: "/feed/entry"
namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"
- Role {
+ XmlRole {
name: "title"
query: "title/string()"
}
- Role {
+ XmlRole {
name: "tagline"
query: "author/name/string()"
}
- Role {
+ XmlRole {
name: "content"
query: "content/string()"
}
diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml
index b465ef1..9d0c956 100644
--- a/examples/declarative/xmldata/yahoonews.qml
+++ b/examples/declarative/xmldata/yahoonews.qml
@@ -9,16 +9,16 @@ Rect {
XmlListModel {
id: feedModel
source: "http://rss.news.yahoo.com/rss/oceania"
- query: "doc($src)/rss/channel/item"
- Role {
+ query: "/rss/channel/item"
+ XmlRole {
name: "title"
query: "title/string()"
}
- Role {
+ XmlRole {
name: "link"
query: "link/string()"
}
- Role {
+ XmlRole {
name: "description"
query: "description/string()"
}
@@ -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: [
@@ -82,12 +74,12 @@ Rect {
toState: "Details"
reversible: true
SequentialAnimation {
- NumericAnimation {
+ NumberAnimation {
duration: 200
properties: "height"
easing: "easeOutQuad"
}
- NumericAnimation {
+ NumberAnimation {
duration: 200
properties: "opacity"
}
diff --git a/src/declarative/extra/extra.pri b/src/declarative/extra/extra.pri
index 2590fbc..a0bbdf4 100644
--- a/src/declarative/extra/extra.pri
+++ b/src/declarative/extra/extra.pri
@@ -1,14 +1,27 @@
SOURCES += \
extra/qnumberformat.cpp \
extra/qmlnumberformatter.cpp \
+ extra/qmldatetimeformatter.cpp \
extra/qfxintegermodel.cpp \
- extra/qmltimer.cpp
+ extra/qmltimer.cpp \
+ extra/qfxanimatedimageitem.cpp \
+ extra/qfxblendedimage.cpp \
+ extra/qfxflowview.cpp \
+ extra/qmlbehaviour.cpp \
+ extra/qbindablemap.cpp
HEADERS += \
extra/qnumberformat.h \
extra/qmlnumberformatter.h \
+ extra/qmldatetimeformatter.h \
extra/qfxintegermodel.h \
- extra/qmltimer.h
+ extra/qmltimer.h \
+ extra/qfxanimatedimageitem.h \
+ extra/qfxanimatedimageitem_p.h \
+ extra/qfxblendedimage.h \
+ extra/qfxflowview.h \
+ extra/qmlbehaviour.h \
+ extra/qbindablemap.h
contains(QT_CONFIG, xmlpatterns) {
QT+=xmlpatterns
diff --git a/src/declarative/util/qbindablemap.cpp b/src/declarative/extra/qbindablemap.cpp
index c8c8ced..c8c8ced 100644
--- a/src/declarative/util/qbindablemap.cpp
+++ b/src/declarative/extra/qbindablemap.cpp
diff --git a/src/declarative/util/qbindablemap.h b/src/declarative/extra/qbindablemap.h
index c76928d..c76928d 100644
--- a/src/declarative/util/qbindablemap.h
+++ b/src/declarative/extra/qbindablemap.h
diff --git a/src/declarative/fx/qfxanimatedimageitem.cpp b/src/declarative/extra/qfxanimatedimageitem.cpp
index d22959a..d22959a 100644
--- a/src/declarative/fx/qfxanimatedimageitem.cpp
+++ b/src/declarative/extra/qfxanimatedimageitem.cpp
diff --git a/src/declarative/fx/qfxanimatedimageitem.h b/src/declarative/extra/qfxanimatedimageitem.h
index 5d115d7..5d115d7 100644
--- a/src/declarative/fx/qfxanimatedimageitem.h
+++ b/src/declarative/extra/qfxanimatedimageitem.h
diff --git a/src/declarative/fx/qfxanimatedimageitem_p.h b/src/declarative/extra/qfxanimatedimageitem_p.h
index cb5da63..e7d8fb8 100644
--- a/src/declarative/fx/qfxanimatedimageitem_p.h
+++ b/src/declarative/extra/qfxanimatedimageitem_p.h
@@ -53,7 +53,7 @@
// We mean it.
//
-#include "qfximage_p.h"
+#include <private/qfximage_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/extra/qfxblendedimage.cpp
index 0c93fef..0c93fef 100644
--- a/src/declarative/fx/qfxblendedimage.cpp
+++ b/src/declarative/extra/qfxblendedimage.cpp
diff --git a/src/declarative/fx/qfxblendedimage.h b/src/declarative/extra/qfxblendedimage.h
index 248cc9d..248cc9d 100644
--- a/src/declarative/fx/qfxblendedimage.h
+++ b/src/declarative/extra/qfxblendedimage.h
diff --git a/src/declarative/fx/qfxflowview.cpp b/src/declarative/extra/qfxflowview.cpp
index 77cd6df..77cd6df 100644
--- a/src/declarative/fx/qfxflowview.cpp
+++ b/src/declarative/extra/qfxflowview.cpp
diff --git a/src/declarative/fx/qfxflowview.h b/src/declarative/extra/qfxflowview.h
index 0e7c2d3..0e7c2d3 100644
--- a/src/declarative/fx/qfxflowview.h
+++ b/src/declarative/extra/qfxflowview.h
diff --git a/src/declarative/util/qmlbehaviour.cpp b/src/declarative/extra/qmlbehaviour.cpp
index 3617541..4beca5e 100644
--- a/src/declarative/util/qmlbehaviour.cpp
+++ b/src/declarative/extra/qmlbehaviour.cpp
@@ -115,7 +115,7 @@ public:
color: "#00ff00"
y: 200 //initial value
y: Behavior {
- NumericAnimation {
+ NumberAnimation {
easing: "easeOutBounce(amplitude:100)"
duration: 200
}
diff --git a/src/declarative/util/qmlbehaviour.h b/src/declarative/extra/qmlbehaviour.h
index 7cc83b2..7cc83b2 100644
--- a/src/declarative/util/qmlbehaviour.h
+++ b/src/declarative/extra/qmlbehaviour.h
diff --git a/src/declarative/util/qmldatetimeformatter.cpp b/src/declarative/extra/qmldatetimeformatter.cpp
index ad0e473..ad0e473 100644
--- a/src/declarative/util/qmldatetimeformatter.cpp
+++ b/src/declarative/extra/qmldatetimeformatter.cpp
diff --git a/src/declarative/util/qmldatetimeformatter.h b/src/declarative/extra/qmldatetimeformatter.h
index 84b27e3..84b27e3 100644
--- a/src/declarative/util/qmldatetimeformatter.h
+++ b/src/declarative/extra/qmldatetimeformatter.h
diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp
index 51905fa..082c9c2 100644
--- a/src/declarative/extra/qmlxmllistmodel.cpp
+++ b/src/declarative/extra/qmlxmllistmodel.cpp
@@ -58,7 +58,7 @@
QT_BEGIN_NAMESPACE
-QML_DEFINE_TYPE(XmlListModelRole, Role)
+QML_DEFINE_TYPE(XmlListModelRole, XmlRole)
QML_DEFINE_TYPE(QmlXmlListModel, XmlListModel)
@@ -105,7 +105,7 @@ public:
m_modelData.clear();
m_size = 0;
m_data = data;
- m_query = query;
+ m_query = QLatin1String("doc($src)") + query;
m_namespaces = namespaces;
m_roleObjects = roleObjects;
if (!isRunning()) {
@@ -224,6 +224,13 @@ void QmlXmlQuery::doSubQueryJob()
//### we might be able to condense even further (query for everything in one go)
for (int i = 0; i < m_roleObjects->size(); ++i) {
XmlListModelRole *role = m_roleObjects->at(i);
+ if (!role->isValid()) {
+ QList<QVariant> resultList;
+ for (int j = 0; j < m_size; ++j)
+ resultList << QVariant();
+ m_modelData << resultList;
+ continue;
+ }
subquery.setQuery(m_prefix + QLatin1String("(let $v := ") + role->query() + QLatin1String(" return if ($v) then ") + role->query() + QLatin1String(" else \"\")"));
QXmlResultItems output3;
subquery.evaluateTo(&output3);
@@ -233,6 +240,9 @@ void QmlXmlQuery::doSubQueryJob()
resultList << item.toAtomicValue(); //### we used to trim strings
item = output3.next();
}
+ //### should warn here if things have gone wrong.
+ while (resultList.count() < m_size)
+ resultList << QVariant();
m_modelData << resultList;
b.seek(0);
}
@@ -308,6 +318,38 @@ void QmlXmlRoleList::append(XmlListModelRole *role) {
model->roleNames << role->name();
++model->highestRole;
}
+
+/*!
+ \qmlclass XmlRole
+ \brief The XmlRole element allows you to specify a role for an XmlListModel.
+*/
+
+/*!
+ \qmlproperty string XmlRole::name
+ The name for the role. This name is used to access the model data for this role from Qml.
+
+ \qml
+ XmlRole { name: "title"; query: "title/string()" }
+
+ ...
+
+ Component {
+ id: Delegate
+ Text { text: title }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlproperty string XmlRole::query
+ The relative XPath query for this role. The query should not start with a '/' (i.e. it must be
+ relative).
+
+ \qml
+ XmlRole { name: "title"; query: "title/string()" }
+ \endqml
+*/
+
//XXX clear, removeAt, and insert need to invalidate any cached data (in data table) as well
// (and the model should emit the appropriate signals)
void QmlXmlRoleList::clear()
@@ -316,12 +358,15 @@ void QmlXmlRoleList::clear()
model->roleNames.clear();
QmlConcreteList<XmlListModelRole *>::clear();
}
+
void QmlXmlRoleList::removeAt(int i)
{
model->roles.removeAt(i);
model->roleNames.removeAt(i);
QmlConcreteList<XmlListModelRole *>::removeAt(i);
}
+
+//### we should enforce unique role names
void QmlXmlRoleList::insert(int i, XmlListModelRole *role)
{
QmlConcreteList<XmlListModelRole *>::insert(i, role);
@@ -332,7 +377,7 @@ void QmlXmlRoleList::insert(int i, XmlListModelRole *role)
/*!
\qmlclass XmlListModel
- \brief The XmlListModel class allows you to specify a model using XQuery.
+ \brief The XmlListModel element allows you to specify a model using XPath expressions.
XmlListModel allows you to construct a model from XML data that can then be used as a data source
for the view classes (ListView, PathView, GridView) and any other classes that interact with model
@@ -343,13 +388,14 @@ void QmlXmlRoleList::insert(int i, XmlListModelRole *role)
XmlListModel {
id: FeedModel
source: "http://rss.news.yahoo.com/rss/oceania"
- query: "doc($src)/rss/channel/item"
- Role { name: "title"; query: "title/string()" }
- Role { name: "link"; query: "link/string()" }
- Role { name: "description"; query: "description/string()" }
+ query: "/rss/channel/item"
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "link"; query: "link/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
}
\endqml
- \note The model is currently static, so the above is really just a snapshot of an RSS feed.
+ \note The model is currently static, so the above is really just a snapshot of an RSS feed. To force a
+ reload of the entire model, you can call the reload function.
*/
QmlXmlListModel::QmlXmlListModel(QObject *parent)
@@ -364,6 +410,11 @@ QmlXmlListModel::~QmlXmlListModel()
{
}
+/*!
+ \qmlproperty list<XmlRole> QmlListModel::roles
+
+ The roles to make available for this model.
+*/
QmlList<XmlListModelRole *> *QmlXmlListModel::roleObjects()
{
Q_D(QmlXmlListModel);
@@ -403,6 +454,10 @@ QString QmlXmlListModel::toString(int role) const
return d->roleNames.at(index);
}
+/*!
+ \qmlproperty url XmlListModel::source
+ The location of the XML data source.
+*/
QUrl QmlXmlListModel::source() const
{
Q_D(const QmlXmlListModel);
@@ -418,6 +473,11 @@ void QmlXmlListModel::setSource(const QUrl &src)
}
}
+/*!
+ \qmlproperty url XmlListModel::query
+ An absolute XPath query representing the base query for the model items. The query should start with
+ a '/' or '//'.
+*/
QString QmlXmlListModel::query() const
{
Q_D(const QmlXmlListModel);
@@ -427,12 +487,21 @@ QString QmlXmlListModel::query() const
void QmlXmlListModel::setQuery(const QString &query)
{
Q_D(QmlXmlListModel);
+ if (!query.startsWith(QLatin1Char('/'))) {
+ qmlInfo(this) << "An XmlListModel query must start with '/' or \"//\"";
+ return;
+ }
+
if (d->query != query) {
d->query = query;
reload();
}
}
+/*!
+ \qmlproperty string XmlListModel::namespaceDeclarations
+ A set of declarations for the namespaces used in the query.
+*/
QString QmlXmlListModel::namespaceDeclarations() const
{
Q_D(const QmlXmlListModel);
@@ -447,12 +516,34 @@ void QmlXmlListModel::setNamespaceDeclarations(const QString &declarations)
reload();
}
}
+
+/*!
+ \qmlproperty enum XmlListModel::status
+
+ This property holds the status of data source loading. It can be one of:
+ \list
+ \o Idle - no data source has been set, or the data source has been loaded
+ \o Loading - the data source is currently being loaded
+ \o Error - an error occurred while loading the data source
+ \endlist
+
+ \sa progress
+
+*/
QmlXmlListModel::Status QmlXmlListModel::status() const
{
Q_D(const QmlXmlListModel);
return d->status;
}
+/*!
+ \qmlproperty real XmlListModel::progress
+
+ This property holds the progress of data source loading, from 0.0 (nothing loaded)
+ to 1.0 (finished).
+
+ \sa status
+*/
qreal QmlXmlListModel::progress() const
{
Q_D(const QmlXmlListModel);
@@ -466,6 +557,12 @@ void QmlXmlListModel::classComplete()
reload();
}
+/*!
+ \qmlmethod XmlListModel::reload()
+
+ Reloads the model. All the existing model data will be removed, and the model
+ will be rebuilt from scratch.
+*/
void QmlXmlListModel::reload()
{
Q_D(QmlXmlListModel);
@@ -484,7 +581,7 @@ void QmlXmlListModel::reload()
emit itemsRemoved(0, count);
if (d->src.isEmpty()) {
- qWarning() << "Can't load empty src string";
+ qmlInfo(this) << "Can't load empty src string";
return;
}
diff --git a/src/declarative/extra/qmlxmllistmodel.h b/src/declarative/extra/qmlxmllistmodel.h
index c6aae4a..0d41456 100644
--- a/src/declarative/extra/qmlxmllistmodel.h
+++ b/src/declarative/extra/qmlxmllistmodel.h
@@ -44,6 +44,7 @@
#include <QtDeclarative/qml.h>
#include <QtDeclarative/QListModelInterface>
+#include <QtDeclarative/qmlinfo.h>
QT_BEGIN_HEADER
@@ -66,7 +67,18 @@ public:
void setName(const QString &name) { m_name = name; }
QString query() const { return m_query; }
- void setQuery(const QString &query) { m_query = query; }
+ void setQuery(const QString &query)
+ {
+ if (query.startsWith(QLatin1Char('/'))) {
+ qmlInfo(this) << "An XmlRole query must not start with '/'";
+ return;
+ }
+ m_query = query;
+ }
+
+ bool isValid() {
+ return !m_name.isEmpty() && !m_query.isEmpty();
+ }
private:
QString m_name;
@@ -88,6 +100,7 @@ class Q_DECLARATIVE_EXPORT QmlXmlListModel : public QListModelInterface, public
Q_PROPERTY(QString namespaceDeclarations READ namespaceDeclarations WRITE setNamespaceDeclarations)
Q_PROPERTY(QmlList<XmlListModelRole *> *roles READ roleObjects)
Q_CLASSINFO("DefaultProperty", "roles")
+
public:
QmlXmlListModel(QObject *parent = 0);
~QmlXmlListModel();
diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri
index 1c819e7..69fada0 100644
--- a/src/declarative/fx/fx.pri
+++ b/src/declarative/fx/fx.pri
@@ -1,8 +1,6 @@
HEADERS += \
fx/qfxanchors.h \
fx/qfxanchors_p.h \
- fx/qfxanimatedimageitem.h \
- fx/qfxblendedimage.h \
fx/qfxblurfilter.h \
fx/qfxcomponentinstance.h \
fx/qfxcomponentinstance_p.h \
@@ -15,7 +13,6 @@ HEADERS += \
fx/qfxfocuspanel.h \
fx/qfxfocusrealm.h \
fx/qfxgridview.h \
- fx/qfxflowview.h \
fx/qfxhighlightfilter.h \
fx/qfximage.h \
fx/qfxpainteditem.h \
@@ -53,8 +50,6 @@ HEADERS += \
SOURCES += \
fx/qfxanchors.cpp \
- fx/qfxanimatedimageitem.cpp \
- fx/qfxblendedimage.cpp \
fx/qfxblurfilter.cpp \
fx/qfxcomponentinstance.cpp \
fx/qfxcontentwrapper.cpp \
@@ -64,7 +59,6 @@ SOURCES += \
fx/qfxfocuspanel.cpp \
fx/qfxfocusrealm.cpp \
fx/qfxgridview.cpp \
- fx/qfxflowview.cpp \
fx/qfxhighlightfilter.cpp \
fx/qfximage.cpp \
fx/qfxpainteditem.cpp \
diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp
index 3da58a2..84ccadf 100644
--- a/src/declarative/fx/qfxanchors.cpp
+++ b/src/declarative/fx/qfxanchors.cpp
@@ -402,8 +402,8 @@ void QFxAnchorsPrivate::updateVerticalAnchors()
if (fill || centeredIn || !isItemComplete())
return;
- if (!updatingVerticalAnchor) {
- updatingVerticalAnchor = true;
+ if (updatingVerticalAnchor < 2) {
+ ++updatingVerticalAnchor;
if (usedAnchors & QFxAnchors::HasTopAnchor) {
//Handle stretching
bool invalid = true;
@@ -455,7 +455,7 @@ void QFxAnchorsPrivate::updateVerticalAnchors()
setItemY(position(baseline.item, baseline.anchorLine) - item->baselineOffset());
}
}
- updatingVerticalAnchor = false;
+ --updatingVerticalAnchor;
} else {
// ### Make this certain :)
qmlInfo(item) << "Possible anchor loop detected on vertical anchor.";
@@ -467,8 +467,8 @@ void QFxAnchorsPrivate::updateHorizontalAnchors()
if (fill || centeredIn || !isItemComplete())
return;
- if (!updatingHorizontalAnchor) {
- updatingHorizontalAnchor = true;
+ if (updatingHorizontalAnchor < 2) {
+ ++updatingHorizontalAnchor;
if (usedAnchors & QFxAnchors::HasLeftAnchor) {
//Handle stretching
@@ -514,7 +514,7 @@ void QFxAnchorsPrivate::updateHorizontalAnchors()
}
}
- updatingHorizontalAnchor = false;
+ --updatingHorizontalAnchor;
} else {
// ### Make this certain :)
qmlInfo(item) << "Possible anchor loop detected on horizontal anchor.";
@@ -772,6 +772,7 @@ void QFxAnchors::setLeftMargin(int offset)
if (d->leftMargin == offset)
return;
d->leftMargin = offset;
+ d->updateHorizontalAnchors();
emit leftMarginChanged();
}
@@ -787,6 +788,7 @@ void QFxAnchors::setRightMargin(int offset)
if (d->rightMargin == offset)
return;
d->rightMargin = offset;
+ d->updateHorizontalAnchors();
emit rightMarginChanged();
}
@@ -802,6 +804,7 @@ void QFxAnchors::setHorizontalCenterOffset(int offset)
if (d->hCenterOffset == offset)
return;
d->hCenterOffset = offset;
+ d->updateHorizontalAnchors();
emit horizontalCenterOffsetChanged();
}
@@ -817,6 +820,7 @@ void QFxAnchors::setTopMargin(int offset)
if (d->topMargin == offset)
return;
d->topMargin = offset;
+ d->updateVerticalAnchors();
emit topMarginChanged();
}
@@ -832,6 +836,7 @@ void QFxAnchors::setBottomMargin(int offset)
if (d->bottomMargin == offset)
return;
d->bottomMargin = offset;
+ d->updateVerticalAnchors();
emit bottomMarginChanged();
}
@@ -847,6 +852,7 @@ void QFxAnchors::setVerticalCenterOffset(int offset)
if (d->vCenterOffset == offset)
return;
d->vCenterOffset = offset;
+ d->updateVerticalAnchors();
emit verticalCenterOffsetChanged();
}
diff --git a/src/declarative/fx/qfxanchors_p.h b/src/declarative/fx/qfxanchors_p.h
index 32d8b75..9ff6869 100644
--- a/src/declarative/fx/qfxanchors_p.h
+++ b/src/declarative/fx/qfxanchors_p.h
@@ -63,8 +63,8 @@ class QFxAnchorsPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QFxAnchors)
public:
QFxAnchorsPrivate()
- : updatingMe(false), updatingHorizontalAnchor(false),
- updatingVerticalAnchor(false), item(0), usedAnchors(0), fill(0),
+ : updatingMe(false), updatingHorizontalAnchor(0),
+ updatingVerticalAnchor(0), item(0), usedAnchors(0), fill(0),
centeredIn(0), leftMargin(0), rightMargin(0), topMargin(0),
bottomMargin(0), vCenterOffset(0), hCenterOffset(0)
{
@@ -80,9 +80,9 @@ public:
void remDepend(QFxItem *);
bool isItemComplete() const;
- bool updatingMe:1;
- bool updatingHorizontalAnchor:1;
- bool updatingVerticalAnchor:1;
+ bool updatingMe;
+ int updatingHorizontalAnchor;
+ int updatingVerticalAnchor;
void setItemHeight(qreal);
void setItemWidth(qreal);
diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp
index 4c02e74..9595724 100644
--- a/src/declarative/fx/qfxflipable.cpp
+++ b/src/declarative/fx/qfxflipable.cpp
@@ -94,7 +94,7 @@ Flipable {
]
transitions: [
Transition {
- NumericAnimation {
+ NumberAnimation {
easing: "easeInOutQuad"
properties: "rotation"
}
diff --git a/src/declarative/fx/qfxhighlightfilter.cpp b/src/declarative/fx/qfxhighlightfilter.cpp
index 1671fc6..78a91af 100644
--- a/src/declarative/fx/qfxhighlightfilter.cpp
+++ b/src/declarative/fx/qfxhighlightfilter.cpp
@@ -80,7 +80,7 @@ Text {
text: "Highlight"
filter: Highlight {
source: "pics/highlight.png"
- xOffset: NumericAnimation {
+ xOffset: NumberAnimation {
running: true
repeat: true
from: 320
diff --git a/src/declarative/fx/qfxlayouts.cpp b/src/declarative/fx/qfxlayouts.cpp
index a975778..e27135c 100644
--- a/src/declarative/fx/qfxlayouts.cpp
+++ b/src/declarative/fx/qfxlayouts.cpp
@@ -132,7 +132,7 @@ BaseLayout {
id: layout
y: 0
move: Transition {
- NumericAnimation {
+ NumberAnimation {
properties: "y"
ease: "easeOutBounce"
}
@@ -161,7 +161,7 @@ BaseLayout {
id: layout
y: 0
add: Transition {
- NumericAnimation {
+ NumberAnimation {
target: layout.item
properties: "opacity"
from: 0
@@ -196,7 +196,7 @@ BaseLayout {
id: layout
y: 0
remove: Transition {
- NumericAnimation {
+ NumberAnimation {
target: layout.item
properties: "opacity"
from: 1
@@ -512,7 +512,7 @@ VerticalLayout {
VerticalLayout {
id: layout
remove: Transition {
- NumericAnimation {
+ NumberAnimation {
target: layout.item
properties: "opacity"
from: 1
@@ -539,7 +539,7 @@ VerticalLayout {
VerticalLayout {
id: layout
add: Transition {
- NumericAnimation {
+ NumberAnimation {
target: layout.item
properties: "opacity"
from: 0
@@ -566,7 +566,7 @@ VerticalLayout {
VerticalLayout {
id: layout
move: Transition {
- NumericAnimation {
+ NumberAnimation {
properties: "y"
ease: "easeOutBounce"
}
@@ -683,7 +683,7 @@ HorizontalLayout {
HorizontalLayout {
id: layout
remove: Transition {
- NumericAnimation {
+ NumberAnimation {
target: layout.item
properties: "opacity"
from: 1
@@ -705,7 +705,7 @@ HorizontalLayout {
HorizontalLayout {
id: layout
add: Transition {
- NumericAnimation {
+ NumberAnimation {
target: layout.item
properties: "opacity"
from: 0
@@ -727,7 +727,7 @@ HorizontalLayout {
HorizontalLayout {
id: layout
move: Transition {
- NumericAnimation {
+ NumberAnimation {
properties: "x"
ease: "easeOutBounce"
}
@@ -875,7 +875,7 @@ GridLayout {
GridLayout {
id: layout
remove: Transition {
- NumericAnimation {
+ NumberAnimation {
target: layout.item
properties: "opacity"
from: 1
@@ -900,7 +900,7 @@ GridLayout {
GridLayout {
id: layout
add: Transition {
- NumericAnimation {
+ NumberAnimation {
target: layout.item
properties: "opacity"
from: 0
@@ -923,7 +923,7 @@ GridLayout {
GridLayout {
id: layout
move: Transition {
- NumericAnimation {
+ NumberAnimation {
properties: "x,y"
ease: "easeOutBounce"
}
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index fd8d9ca..0536f12 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -55,9 +55,9 @@ QML_DEFINE_TYPE(QFxGradient,Gradient)
\brief The QFxPen class provides a pen used for drawing rect borders on a QFxView.
By default, the pen is invalid and nothing is drawn. You must either set a color (then the default
- width is 0) or a width (then the default color is black).
+ width is 1) or a width (then the default color is black).
- A width of 0 indicates a cosmetic pen, a single-pixel line on the border of the item being painted.
+ A width of 1 indicates is a single-pixel line on the border of the item being painted.
Example:
\qml
@@ -68,9 +68,9 @@ QML_DEFINE_TYPE(QFxGradient,Gradient)
/*! \property QFxPen::width
\brief the width of the pen.
- A width of 0 is a single-pixel line on the border of the item being painted.
+ A width of 1 is a single-pixel line on the border of the item being painted.
- If the width is less than 0 the pen is considered invalid and won't be used.
+ If the width is less than 1 the pen is considered invalid and won't be used.
*/
/*!
@@ -103,18 +103,18 @@ void QFxPen::setColor(const QColor &c)
\brief the width of the pen.
\qml
- // rect with green border using hexidecimal notation
Rect { pen.width: 4 }
\endqml
- A width of 0 creates a thin line. For no line, use a negative width or a transparent color.
+ A width of 1 creates a thin line. For no line, use a width of 0 or a transparent color.
- Odd pen widths generally lead to half-pixel painting.
+ To keep the border smooth (rather than blurry), odd pen widths cause the rect to be painted at
+ a half-pixel offset;
*/
void QFxPen::setWidth(int w)
{
_width = w;
- _valid = (_width < 0) ? false : true;
+ _valid = (_width < 1) ? false : true;
emit updated();
}
@@ -505,7 +505,10 @@ void QFxRect::generateRoundedRect()
p.setPen(Qt::NoPen);
}
p.setBrush(d->color);
- p.drawRoundedRect((pw+1)/2, (pw+1)/2, d->rectImage.width()-(pw+1)/2*2, d->rectImage.height()-(pw+1)/2*2, d->radius, d->radius);
+ if (pw%2)
+ p.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, d->rectImage.width()-(pw+1), d->rectImage.height()-(pw+1)), d->radius, d->radius);
+ else
+ p.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, d->rectImage.width()-pw, d->rectImage.height()-pw), d->radius, d->radius);
}
}
@@ -520,12 +523,16 @@ void QFxRect::generateBorderedRect()
p.setRenderHint(QPainter::Antialiasing);
if (d->pen && d->pen->isValid()) {
QPen pn(QColor(d->pen->color()), d->pen->width());
+ pn.setJoinStyle(Qt::MiterJoin);
p.setPen(pn);
} else {
p.setPen(Qt::NoPen);
}
p.setBrush(d->color);
- p.drawRect(qreal(pw+1)/2, qreal(pw+1)/2, d->rectImage.width()-(pw+1)/2*2, d->rectImage.height()-(pw+1)/2*2);
+ if (pw%2)
+ p.drawRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, d->rectImage.width()-(pw+1), d->rectImage.height()-(pw+1)));
+ else
+ p.drawRect(QRectF(qreal(pw)/2, qreal(pw)/2, d->rectImage.width()-pw, d->rectImage.height()-pw));
}
}
#elif defined(QFX_RENDER_OPENGL)
@@ -550,7 +557,10 @@ void QFxRect::generateRoundedRect()
p.setPen(Qt::NoPen);
}
p.setBrush(d->color);
- p.drawRoundedRect((pw+1)/2, (pw+1)/2, roundRect.width()-(pw+1)/2*2, roundRect.height()-(pw+1)/2*2, d->radius, d->radius);
+ if (pw%2)
+ p.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, roundRect.width()-(pw+1), roundRect.height()-(pw+1)), d->radius, d->radius);
+ else
+ p.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, roundRect.width()-pw, roundRect.height()-pw), d->radius, d->radius);
d->rectTexture = cachedTexture(key, roundRect);
}
@@ -573,12 +583,16 @@ void QFxRect::generateBorderedRect()
p.setRenderHint(QPainter::Antialiasing);
if (d->pen && d->pen->isValid()) {
QPen pn(QColor(pen()->color()), pen()->width());
+ pn.setJoinStyle(Qt::MiterJoin);
p.setPen(pn);
} else {
p.setPen(Qt::NoPen);
}
p.setBrush(d->color);
- p.drawRect(qreal(pw+1)/2, qreal(pw+1)/2, borderedRect.width()-(pw+1)/2*2, borderedRect.height()-(pw+1)/2*2);
+ if (pw%2)
+ p.drawRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, borderedRect.width()-(pw+1), borderedRect.height()-(pw+1)));
+ else
+ p.drawRect(QRectF(qreal(pw)/2, qreal(pw)/2, borderedRect.width()-pw, borderedRect.height()-pw));
d->rectTexture = cachedTexture(key, borderedRect);
}
}
diff --git a/src/declarative/fx/qfxrect.h b/src/declarative/fx/qfxrect.h
index c279a1c..df490b0 100644
--- a/src/declarative/fx/qfxrect.h
+++ b/src/declarative/fx/qfxrect.h
@@ -58,7 +58,7 @@ class Q_DECLARATIVE_EXPORT QFxPen : public QObject
Q_PROPERTY(QColor color READ color WRITE setColor)
public:
QFxPen(QObject *parent=0)
- : QObject(parent), _width(0), _color("#000000"), _valid(false)
+ : QObject(parent), _width(1), _color("#000000"), _valid(false)
{}
int width() const { return _width; }
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/qmldom.cpp b/src/declarative/qml/qmldom.cpp
index 42b40b6..5271dc5 100644
--- a/src/declarative/qml/qmldom.cpp
+++ b/src/declarative/qml/qmldom.cpp
@@ -969,11 +969,11 @@ void QmlDomValueBinding::setBinding(const QString &expression)
In QML, value sources are special value generating types that may be
assigned to properties. Value sources inherit the QmlPropertyValueSource
class. In the example below, the "x" property is being assigned the
- NumericAnimation value source.
+ NumberAnimation value source.
\qml
Rect {
- x: NumericAnimation {
+ x: NumberAnimation {
from: 0
to: 100
repeat: true
@@ -1018,11 +1018,11 @@ QmlDomValueValueSource &QmlDomValueValueSource::operator=(const QmlDomValueValue
/*!
Return the value source object.
- In the example below, an object representing the NumericAnimation will be
+ In the example below, an object representing the NumberAnimation will be
returned.
\qml
Rect {
- x: NumericAnimation {
+ x: NumberAnimation {
from: 0
to: 100
repeat: true
@@ -1367,7 +1367,7 @@ Item {
\qml
Item {
x: 10
- x: NumericAnimation {
+ x: NumberAnimation {
running: false
from: 0
to: 100
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..4ee5545 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -60,7 +60,7 @@
/* TODO:
Check for any memory leaks
easing should be a QEasingCurve-type property
- All other XXXs
+ All other XXXs and ###s
*/
QT_BEGIN_NAMESPACE
@@ -85,11 +85,17 @@ QEasingCurve stringToCurve(const QString &curve)
QString prop_str =
easeName.mid(idx + 1, easeName.length() - 1 - idx - 1);
normalizedCurve = easeName.left(idx);
+ if (!normalizedCurve.startsWith(QLatin1String("ease"))) {
+ qWarning("QEasingCurve: Easing function '%s' must start with 'ease'",
+ curve.toLatin1().constData());
+ }
props = prop_str.split(QLatin1Char(','));
}
- normalizedCurve = normalizedCurve.mid(4);
+ if (normalizedCurve.startsWith(QLatin1String("ease")))
+ normalizedCurve = normalizedCurve.mid(4);
+
//XXX optimize?
int index = QEasingCurve::staticMetaObject.indexOfEnumerator("Type");
QMetaEnum me = QEasingCurve::staticMetaObject.enumerator(index);
@@ -179,7 +185,7 @@ QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObj
\code
Rect {
width: 100; height: 100
- x: NumericAnimation {
+ x: NumberAnimation {
running: MyMouse.pressed
from: 0; to: 100
}
@@ -192,7 +198,7 @@ QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObj
or not the animation is running.
\code
- NumericAnimation { id: MyAnimation }
+ NumberAnimation { id: MyAnimation }
Text { text: MyAnimation.running ? "Animation is running" : "Animation is not running" }
\endcode
@@ -349,7 +355,7 @@ void QmlAbstractAnimation::setFinishPlaying(bool f)
\code
Rect {
- rotation: NumericAnimation { running: true; repeat: true; from: 0 to: 360 }
+ rotation: NumberAnimation { running: true; repeat: true; from: 0 to: 360 }
}
\endcode
*/
@@ -371,6 +377,16 @@ void QmlAbstractAnimation::setRepeat(bool r)
emit repeatChanged(r);
}
+int QmlAbstractAnimation::currentTime()
+{
+ return qtAnimation()->currentTime();
+}
+
+void QmlAbstractAnimation::setCurrentTime(int time)
+{
+ qtAnimation()->setCurrentTime(time);
+}
+
QmlAnimationGroup *QmlAbstractAnimation::group() const
{
Q_D(const QmlAbstractAnimation);
@@ -502,7 +518,7 @@ void QmlAbstractAnimation::resume()
no further influence on property values. In this example animation
\code
Rect {
- x: NumericAnimation { from: 0; to: 100; duration: 500 }
+ x: NumberAnimation { from: 0; to: 100; duration: 500 }
}
\endcode
was stopped at time 250ms, the \c x property will have a value of 50.
@@ -540,7 +556,7 @@ void QmlAbstractAnimation::restart()
its end. In the following example,
\code
Rect {
- x: NumericAnimation { from: 0; to: 100; duration: 500 }
+ x: NumberAnimation { from: 0; to: 100; duration: 500 }
}
\endcode
calling \c stop() at time 250ms will result in the \c x property having
@@ -596,9 +612,9 @@ void QmlAbstractAnimation::timelineComplete()
A 500ms animation sequence, with a 100ms pause between two animations:
\code
SequentialAnimation {
- NumericAnimation { ... duration: 200 }
+ NumberAnimation { ... duration: 200 }
PauseAnimation { duration: 100 }
- NumericAnimation { ... duration: 200 }
+ NumberAnimation { ... duration: 200 }
}
\endcode
*/
@@ -683,16 +699,12 @@ QAbstractAnimation *QmlPauseAnimation::qtAnimation()
/*!
\qmlclass ColorAnimation QmlColorAnimation
- \inherits Animation
+ \inherits PropertyAnimation
\brief The ColorAnimation allows you to animate color changes.
\code
ColorAnimation { from: "white"; to: "#c0c0c0"; duration: 100 }
\endcode
-
- The default property animated is \c color, but like other animations,
- this can be changed by setting \c property. The \c color property will
- still animate. XXX is this a bug?
*/
/*!
\internal
@@ -706,56 +718,18 @@ QAbstractAnimation *QmlPauseAnimation::qtAnimation()
*/
QmlColorAnimation::QmlColorAnimation(QObject *parent)
-: QmlAbstractAnimation(*(new QmlColorAnimationPrivate), parent)
+: QmlPropertyAnimation(parent)
{
- Q_D(QmlColorAnimation);
+ Q_D(QmlPropertyAnimation);
d->init();
+ d->interpolatorType = QMetaType::QColor;
+ d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
}
QmlColorAnimation::~QmlColorAnimation()
{
}
-void QmlColorAnimationPrivate::init()
-{
- Q_Q(QmlColorAnimation);
- ca = new QmlTimeLineValueAnimator(q);
- ca->setStartValue(QVariant(0.0f));
- ca->setEndValue(QVariant(1.0f));
-}
-
-/*!
- \qmlproperty int ColorAnimation::duration
- This property holds the duration of the color transition, in milliseconds.
-
- The default value is 250.
-*/
-/*!
- \property QmlColorAnimation::duration
- \brief the duration of the transition, in milliseconds.
-
- The default value is 250.
-*/
-int QmlColorAnimation::duration() const
-{
- Q_D(const QmlColorAnimation);
- return d->ca->duration();
-}
-
-void QmlColorAnimation::setDuration(int duration)
-{
- if (duration < 0) {
- qWarning("QmlColorAnimation: Cannot set a duration of < 0");
- return;
- }
-
- Q_D(QmlColorAnimation);
- if (d->ca->duration() == duration)
- return;
- d->ca->setDuration(duration);
- emit durationChanged(duration);
-}
-
/*!
\qmlproperty color ColorAnimation::from
This property holds the starting color.
@@ -766,18 +740,13 @@ void QmlColorAnimation::setDuration(int duration)
*/
QColor QmlColorAnimation::from() const
{
- Q_D(const QmlColorAnimation);
- return d->fromValue;
+ Q_D(const QmlPropertyAnimation);
+ return d->from.value<QColor>();
}
void QmlColorAnimation::setFrom(const QColor &f)
{
- Q_D(QmlColorAnimation);
- if (d->fromIsDefined && f == d->fromValue)
- return;
- d->fromValue = f;
- d->fromIsDefined = f.isValid();
- emit fromChanged(f);
+ QmlPropertyAnimation::setFrom(f);
}
/*!
@@ -790,202 +759,15 @@ void QmlColorAnimation::setFrom(const QColor &f)
*/
QColor QmlColorAnimation::to() const
{
- Q_D(const QmlColorAnimation);
- return d->toValue;
+ Q_D(const QmlPropertyAnimation);
+ return d->to.value<QColor>();
}
void QmlColorAnimation::setTo(const QColor &t)
{
- Q_D(QmlColorAnimation);
- if (d->toIsDefined && t == d->toValue)
- return;
- d->toValue = t;
- d->toIsDefined = t.isValid();
- emit toChanged(t);
-}
-
-/*!
- \qmlproperty string ColorAnimation::easing
- This property holds the easing curve used for the transition.
-
- Each channel of the color is eased using the same easing curve.
- See NumericAnimation::easing for a full discussion of easing,
- and a list of available curves.
-*/
-QString QmlColorAnimation::easing() const
-{
- Q_D(const QmlColorAnimation);
- return d->easing;
-}
-
-void QmlColorAnimation::setEasing(const QString &e)
-{
- Q_D(QmlColorAnimation);
- if (d->easing == e)
- return;
-
- d->easing = e;
- d->ca->setEasingCurve(stringToCurve(d->easing));
- emit easingChanged(e);
-}
-
-/*!
- \qmlproperty list<Item> ColorAnimation::filter
- This property holds the items selected to be affected by this animation (all if not set).
- \sa exclude
-*/
-QList<QObject *> *QmlColorAnimation::filter()
-{
- Q_D(QmlColorAnimation);
- return &d->filter;
+ QmlPropertyAnimation::setTo(t);
}
-/*!
- \qmlproperty list<Item> ColorAnimation::exclude
- This property holds the items not to be affected by this animation.
- \sa filter
-*/
-QList<QObject *> *QmlColorAnimation::exclude()
-{
- Q_D(QmlColorAnimation);
- return &d->exclude;
-}
-
-void QmlColorAnimation::prepare(QmlMetaProperty &p)
-{
- Q_D(QmlColorAnimation);
- if (d->userProperty.isNull)
- d->property = p;
- else
- d->property = d->userProperty;
- d->fromSourced = false;
- d->value.QmlTimeLineValue::setValue(0.);
- d->ca->setAnimValue(&d->value, QAbstractAnimation::KeepWhenStopped);
- d->ca->setFromSourcedValue(&d->fromSourced);
-}
-
-QAbstractAnimation *QmlColorAnimation::qtAnimation()
-{
- Q_D(QmlColorAnimation);
- return d->ca;
-}
-
-void QmlColorAnimation::transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
- TransitionDirection direction)
-{
- Q_D(QmlColorAnimation);
- Q_UNUSED(direction);
-
- struct NTransitionData : public QmlTimeLineValue
- {
- QmlStateActions actions;
- void write(QmlMetaProperty &property, const QVariant &color)
- {
- if (property.propertyType() == QVariant::Color) {
- property.write(color);
- }
- }
-
- void setValue(qreal v)
- {
- QmlTimeLineValue::setValue(v);
- for (int ii = 0; ii < actions.count(); ++ii) {
- Action &action = actions[ii];
-
- QColor to(action.toValue.value<QColor>());
-
- if (v == 1.) {
- write(action.property, to);
- } else {
- if (action.fromValue.isNull()) {
- action.fromValue = action.property.read();
- if (action.fromValue.isNull())
- action.fromValue = QVariant(QColor());
- }
-
- QColor from(action.fromValue.value<QColor>());
-
- QVariant newColor = QmlColorAnimationPrivate::colorInterpolator(&from, &to, v);
- write(action.property, newColor);
- }
- }
- }
- };
-
- //XXX should we get rid of this?
- QStringList props;
- props << QLatin1String("color");
- if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
- props.append(d->propertyName);
-
- NTransitionData *data = new NTransitionData;
-
- QSet<QObject *> objs;
- for (int ii = 0; ii < actions.count(); ++ii) {
- Action &action = actions[ii];
-
- QObject *obj = action.property.object();
- QString propertyName = action.property.name();
-
- if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
- (!d->exclude.contains(obj)) && props.contains(propertyName) &&
- (!target() || target() == obj)) {
- objs.insert(obj);
- Action myAction = action;
-
- if (d->fromIsDefined) {
- myAction.fromValue = QVariant(d->fromValue);
- } else {
- myAction.fromValue = QVariant();
- }
- if (d->toIsDefined)
- myAction.toValue = QVariant(d->toValue);
-
- modified << action.property;
- data->actions << myAction;
- action.fromValue = myAction.toValue;
- }
- }
-
- if (d->toValue.isValid() && target() && !objs.contains(target())) {
- QObject *obj = target();
- for (int jj = 0; jj < props.count(); ++jj) {
- Action myAction;
- myAction.property = QmlMetaProperty(obj, props.at(jj));
-
- if (d->fromIsDefined)
- myAction.fromValue = QVariant(d->fromValue);
-
- myAction.toValue = QVariant(d->toValue);
- myAction.bv = 0;
- myAction.event = 0;
- data->actions << myAction;
- }
- }
-
- if (data->actions.count())
- d->ca->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
- else
- delete data;
-}
-
-QVariantAnimation::Interpolator QmlColorAnimationPrivate::colorInterpolator = 0;
-
-void QmlColorAnimationPrivate::valueChanged(qreal v)
-{
- if (!fromSourced) {
- if (!fromIsDefined) {
- fromValue = qvariant_cast<QColor>(property.read());
- }
- fromSourced = true;
- }
-
- if (property.propertyType() == QVariant::Color) {
- QVariant newColor = colorInterpolator(&fromValue, &toValue, v);
- property.write(newColor);
- }
-}
QML_DEFINE_TYPE(QmlColorAnimation,ColorAnimation)
/*!
@@ -1395,391 +1177,82 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
QML_DEFINE_TYPE(QmlParentChangeAction,ParentChangeAction)
/*!
- \qmlclass NumericAnimation QmlNumericAnimation
- \inherits Animation
- \brief The NumericAnimation allows you to animate changes in properties of type qreal.
+ \qmlclass NumberAnimation QmlNumberAnimation
+ \inherits PropertyAnimation
+ \brief The NumberAnimation allows you to animate changes in properties of type qreal.
Animate a set of properties over 200ms, from their values in the start state to
their values in the end state of the transition:
\code
- NumericAnimation { properties: "x,y,scale"; duration: 200 }
+ NumberAnimation { properties: "x,y,scale"; duration: 200 }
\endcode
*/
/*!
\internal
- \class QmlNumericAnimation
+ \class QmlNumberAnimation
\ingroup group_animation
\ingroup group_states
- \brief The QmlNumericAnimation class allows you to animate changes in properties of type qreal.
+ \brief The QmlNumberAnimation class allows you to animate changes in properties of type qreal.
- A QmlNumericAnimation object can be instantiated in Qml using the tag
- \l{xmlNumericAnimation} {&lt;NumericAnimation&gt;}.
+ A QmlNumberAnimation object can be instantiated in Qml using the tag
+ \l{xmlNumberAnimation} {&lt;NumberAnimation&gt;}.
*/
-QmlNumericAnimation::QmlNumericAnimation(QObject *parent)
-: QmlAbstractAnimation(*(new QmlNumericAnimationPrivate), parent)
+QmlNumberAnimation::QmlNumberAnimation(QObject *parent)
+: QmlPropertyAnimation(parent)
{
- Q_D(QmlNumericAnimation);
+ Q_D(QmlPropertyAnimation);
d->init();
+ d->interpolatorType = QMetaType::QReal;
+ d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
}
-QmlNumericAnimation::~QmlNumericAnimation()
-{
-}
-
-void QmlNumericAnimationPrivate::init()
+QmlNumberAnimation::~QmlNumberAnimation()
{
- Q_Q(QmlNumericAnimation);
- na = new QmlTimeLineValueAnimator(q);
- na->setStartValue(QVariant(0.0f));
- na->setEndValue(QVariant(1.0f));
}
/*!
- \qmlproperty int NumericAnimation::duration
- This property holds the duration of the transition, in milliseconds.
-
- The default value is 250.
-*/
-/*!
- \property QmlNumericAnimation::duration
- \brief the duration of the transition, in milliseconds.
-
- The default value is 250.
-*/
-int QmlNumericAnimation::duration() const
-{
- Q_D(const QmlNumericAnimation);
- return d->na->duration();
-}
-
-void QmlNumericAnimation::setDuration(int duration)
-{
- if (duration < 0) {
- qWarning("QmlNumericAnimation: Cannot set a duration of < 0");
- return;
- }
-
- Q_D(QmlNumericAnimation);
- if (d->na->duration() == duration)
- return;
- d->na->setDuration(duration);
- emit durationChanged(duration);
-}
-
-/*!
- \qmlproperty real NumericAnimation::from
+ \qmlproperty real NumberAnimation::from
This property holds the starting value.
If not set, then the value defined in the start state of the transition.
*/
/*!
- \property QmlNumericAnimation::from
+ \property QmlNumberAnimation::from
\brief the starting value.
*/
-qreal QmlNumericAnimation::from() const
+qreal QmlNumberAnimation::from() const
{
- Q_D(const QmlNumericAnimation);
- return d->from;
+ Q_D(const QmlPropertyAnimation);
+ return d->from.toDouble(); //### toFloat?
}
-void QmlNumericAnimation::setFrom(qreal f)
+void QmlNumberAnimation::setFrom(qreal f)
{
- Q_D(QmlNumericAnimation);
- if (!d->from.isNull && f == d->from)
- return;
- d->from = f;
- emit fromChanged(f);
+ QmlPropertyAnimation::setFrom(f);
}
/*!
- \qmlproperty real NumericAnimation::to
+ \qmlproperty real NumberAnimation::to
This property holds the ending value.
If not set, then the value defined in the end state of the transition.
*/
/*!
- \property QmlNumericAnimation::to
+ \property QmlNumberAnimation::to
\brief the ending value.
*/
-qreal QmlNumericAnimation::to() const
-{
- Q_D(const QmlNumericAnimation);
- return d->to;
-}
-
-void QmlNumericAnimation::setTo(qreal t)
-{
- Q_D(QmlNumericAnimation);
- if (!d->to.isNull && t == d->to)
- return;
- d->to = t;
- emit toChanged(t);
-}
-
-/*!
- \qmlproperty string NumericAnimation::easing
- \brief the easing curve used for the transition.
-
- Available values are:
-
- \list
- \i \e easeNone - Easing equation function for a simple linear tweening, with no easing.
- \i \e easeInQuad - Easing equation function for a quadratic (t^2) easing in: accelerating from zero velocity.
- \i \e easeOutQuad - Easing equation function for a quadratic (t^2) easing out: decelerating to zero velocity.
- \i \e easeInOutQuad - Easing equation function for a quadratic (t^2) easing in/out: acceleration until halfway, then deceleration.
- \i \e easeOutInQuad - Easing equation function for a quadratic (t^2) easing out/in: deceleration until halfway, then acceleration.
- \i \e easeInCubic - Easing equation function for a cubic (t^3) easing in: accelerating from zero velocity.
- \i \e easeOutCubic - Easing equation function for a cubic (t^3) easing out: decelerating from zero velocity.
- \i \e easeInOutCubic - Easing equation function for a cubic (t^3) easing in/out: acceleration until halfway, then deceleration.
- \i \e easeOutInCubic - Easing equation function for a cubic (t^3) easing out/in: deceleration until halfway, then acceleration.
- \i \e easeInQuart - Easing equation function for a quartic (t^4) easing in: accelerating from zero velocity.
- \i \e easeOutQuart - Easing equation function for a quartic (t^4) easing out: decelerating from zero velocity.
- \i \e easeInOutQuart - Easing equation function for a quartic (t^4) easing in/out: acceleration until halfway, then deceleration.
- \i \e easeOutInQuart - Easing equation function for a quartic (t^4) easing out/in: deceleration until halfway, then acceleration.
- \i \e easeInQuint - Easing equation function for a quintic (t^5) easing in: accelerating from zero velocity.
- \i \e easeOutQuint - Easing equation function for a quintic (t^5) easing out: decelerating from zero velocity.
- \i \e easeInOutQuint - Easing equation function for a quintic (t^5) easing in/out: acceleration until halfway, then deceleration.
- \i \e easeOutInQuint - Easing equation function for a quintic (t^5) easing out/in: deceleration until halfway, then acceleration.
- \i \e easeInSine - Easing equation function for a sinusoidal (sin(t)) easing in: accelerating from zero velocity.
- \i \e easeOutSine - Easing equation function for a sinusoidal (sin(t)) easing out: decelerating from zero velocity.
- \i \e easeInOutSine - Easing equation function for a sinusoidal (sin(t)) easing in/out: acceleration until halfway, then deceleration.
- \i \e easeOutInSine - Easing equation function for a sinusoidal (sin(t)) easing out/in: deceleration until halfway, then acceleration.
- \i \e easeInExpo - Easing equation function for an exponential (2^t) easing in: accelerating from zero velocity.
- \i \e easeOutExpo - Easing equation function for an exponential (2^t) easing out: decelerating from zero velocity.
- \i \e easeInOutExpo - Easing equation function for an exponential (2^t) easing in/out: acceleration until halfway, then deceleration.
- \i \e easeOutInExpo - Easing equation function for an exponential (2^t) easing out/in: deceleration until halfway, then acceleration.
- \i \e easeInCirc - Easing equation function for a circular (sqrt(1-t^2)) easing in: accelerating from zero velocity.
- \i \e easeOutCirc - Easing equation function for a circular (sqrt(1-t^2)) easing out: decelerating from zero velocity.
- \i \e easeInOutCirc - Easing equation function for a circular (sqrt(1-t^2)) easing in/out: acceleration until halfway, then deceleration.
- \i \e easeOutInCirc - Easing equation function for a circular (sqrt(1-t^2)) easing out/in: deceleration until halfway, then acceleration.
- \i \e easeInElastic - Easing equation function for an elastic (exponentially decaying sine wave) easing in: accelerating from zero velocity. The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter.
- \i \e easeOutElastic - Easing equation function for an elastic (exponentially decaying sine wave) easing out: decelerating from zero velocity. The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter.
- \i \e easeInOutElastic - Easing equation function for an elastic (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration.
- \i \e easeOutInElastic - Easing equation function for an elastic (exponentially decaying sine wave) easing out/in: deceleration until halfway, then acceleration.
- \i \e easeInBack - Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity.
- \i \e easeOutBack - Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out: decelerating from zero velocity.
- \i \e easeInOutBack - Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration.
- \i \e easeOutInBack - Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration.
- \i \e easeOutBounce - Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity.
- \i \e easeInBounce - Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity.
- \i \e easeInOutBounce - Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration.
- \i \e easeOutInBounce - Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out/in: deceleration until halfway, then acceleration.
- \endlist
-*/
-
-/*!
- \property QmlNumericAnimation::easing
- This property holds the easing curve to use.
-
- \sa QEasingCurve
-*/
-QString QmlNumericAnimation::easing() const
-{
- Q_D(const QmlNumericAnimation);
- return d->easing;
-}
-
-void QmlNumericAnimation::setEasing(const QString &e)
-{
- Q_D(QmlNumericAnimation);
- if (d->easing == e)
- return;
-
- d->easing = e;
- d->na->setEasingCurve(stringToCurve(d->easing));
- emit easingChanged(e);
-}
-
-/*!
- \qmlproperty string NumericAnimation::properties
- This property holds the properties this animation should be applied to.
-
- This is a comma-separated list of properties that should use
- this animation when they change.
-*/
-/*!
- \property QmlNumericAnimation::properties
- \brief the properties this animation should be applied to.
-
- properties holds a comma-separated list of properties that should use
- this animation when they change.
-*/
-QString QmlNumericAnimation::properties() const
-{
- Q_D(const QmlNumericAnimation);
- return d->properties;
-}
-
-void QmlNumericAnimation::setProperties(const QString &prop)
-{
- Q_D(QmlNumericAnimation);
- if (d->properties == prop)
- return;
-
- d->properties = prop;
- emit propertiesChanged(prop);
-}
-
-/*!
- \qmlproperty list<Item> NumericAnimation::filter
- This property holds the items selected to be affected by this animation (all if not set).
- \sa exclude
-*/
-QList<QObject *> *QmlNumericAnimation::filter()
-{
- Q_D(QmlNumericAnimation);
- return &d->filter;
-}
-
-/*!
- \qmlproperty list<Item> NumericAnimation::exclude
- This property holds the items not to be affected by this animation.
- \sa filter
-*/
-QList<QObject *> *QmlNumericAnimation::exclude()
-{
- Q_D(QmlNumericAnimation);
- return &d->exclude;
-}
-
-void QmlNumericAnimationPrivate::valueChanged(qreal r)
-{
- if (!fromSourced) {
- if (from.isNull) {
- fromValue = qvariant_cast<qreal>(property.read());
- } else {
- fromValue = from;
- }
- fromSourced = true;
- }
-
- if (r == 1.) {
- property.write(to.value);
- } else {
- qreal val = fromValue + (to-fromValue) * r;
- property.write(val);
- }
-}
-
-void QmlNumericAnimation::prepare(QmlMetaProperty &p)
+qreal QmlNumberAnimation::to() const
{
- Q_D(QmlNumericAnimation);
- if (d->userProperty.isNull)
- d->property = p;
- else
- d->property = d->userProperty;
- d->fromSourced = false;
- d->value.QmlTimeLineValue::setValue(0.);
- d->na->setAnimValue(&d->value, QAbstractAnimation::KeepWhenStopped);
- d->na->setFromSourcedValue(&d->fromSourced);
+ Q_D(const QmlPropertyAnimation);
+ return d->to.toDouble(); //### toFloat?
}
-QAbstractAnimation *QmlNumericAnimation::qtAnimation()
+void QmlNumberAnimation::setTo(qreal t)
{
- Q_D(QmlNumericAnimation);
- return d->na;
+ QmlPropertyAnimation::setTo(t);
}
-void QmlNumericAnimation::transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
- TransitionDirection direction)
-{
- Q_D(QmlNumericAnimation);
- Q_UNUSED(direction);
-
- struct NTransitionData : public QmlTimeLineValue
- {
- QmlStateActions actions;
- void setValue(qreal v)
- {
- QmlTimeLineValue::setValue(v);
- for (int ii = 0; ii < actions.count(); ++ii) {
- Action &action = actions[ii];
-
- QmlBehaviour::_ignore = true;
- if (v == 1.)
- action.property.write(action.toValue.toDouble());
- else {
- if (action.fromValue.isNull()) {
- action.fromValue = action.property.read();
- if (action.fromValue.isNull()) {
- action.fromValue = QVariant(0.);
- }
- }
- qreal start = action.fromValue.toDouble();
- qreal end = action.toValue.toDouble();
- qreal val = start + (end-start) * v;
- action.property.write(val);
- }
- QmlBehaviour::_ignore = false;
- }
- }
- };
-
- QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(','));
- for (int ii = 0; ii < props.count(); ++ii)
- props[ii] = props.at(ii).trimmed();
- if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
- props.append(d->propertyName);
-
- if (d->userProperty.isValid() && props.isEmpty() && !target()) {
- props.append(d->userProperty.value.name());
- d->target = d->userProperty.value.object();
- }
-
- NTransitionData *data = new NTransitionData;
-
- QSet<QObject *> objs;
- for (int ii = 0; ii < actions.count(); ++ii) {
- Action &action = actions[ii];
-
- QObject *obj = action.property.object();
- QString propertyName = action.property.name();
-
- if ((d->filter.isEmpty() || d->filter.contains(obj)) &&
- (!d->exclude.contains(obj)) && props.contains(propertyName) &&
- (!target() || target() == obj)) {
- objs.insert(obj);
- Action myAction = action;
- if (d->from.isValid()) {
- myAction.fromValue = QVariant(d->from);
- } else {
- myAction.fromValue = QVariant();
- }
- if (d->to.isValid())
- myAction.toValue = QVariant(d->to);
-
- modified << action.property;
-
- data->actions << myAction;
- action.fromValue = myAction.toValue;
- }
- }
-
- if (d->to.isValid() && target() && !objs.contains(target())) {
- QObject *obj = target();
- for (int jj = 0; jj < props.count(); ++jj) {
- Action myAction;
- myAction.property = QmlMetaProperty(obj, props.at(jj));
-
- if (d->from.isValid())
- myAction.fromValue = QVariant(d->from);
-
- myAction.toValue = QVariant(d->to);
- myAction.bv = 0;
- myAction.event = 0;
- data->actions << myAction;
- }
- }
-
- if (data->actions.count()) {
- d->na->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
- } else {
- delete data;
- }
-}
-
-QML_DEFINE_TYPE(QmlNumericAnimation,NumericAnimation)
+QML_DEFINE_TYPE(QmlNumberAnimation,NumberAnimation)
QmlAnimationGroup::QmlAnimationGroup(QObject *parent)
: QmlAbstractAnimation(*(new QmlAnimationGroupPrivate), parent)
@@ -1808,8 +1281,8 @@ QmlList<QmlAbstractAnimation *> *QmlAnimationGroup::animations()
\code
SequentialAnimation {
- NumericAnimation { target: MyItem; property: "x"; to: 100 }
- NumericAnimation { target: MyItem; property: "x"; to: 0 }
+ NumberAnimation { target: MyItem; property: "x"; to: 100 }
+ NumberAnimation { target: MyItem; property: "x"; to: 0 }
}
\endcode
@@ -1891,8 +1364,8 @@ QML_DEFINE_TYPE(QmlSequentialAnimation,SequentialAnimation)
\code
ParallelAnimation {
- NumericAnimation { target: MyItem; property: "x"; to: 100 }
- NumericAnimation { target: MyItem; property: "y"; to: 100 }
+ NumberAnimation { target: MyItem; property: "x"; to: 100 }
+ NumberAnimation { target: MyItem; property: "y"; to: 100 }
}
\endcode
@@ -1961,17 +1434,23 @@ void QmlParallelAnimation::transition(QmlStateActions &actions,
QML_DEFINE_TYPE(QmlParallelAnimation,ParallelAnimation)
-QVariant QmlVariantAnimationPrivate::interpolateVariant(const QVariant &from, const QVariant &to, qreal progress)
+//### profile and optimize
+QVariant QmlPropertyAnimationPrivate::interpolateVariant(const QVariant &from, const QVariant &to, qreal progress)
{
if (from.userType() != to.userType())
return QVariant();
QVariantAnimation::Interpolator interpolator = QVariantAnimationPrivate::getInterpolator(from.userType());
- return interpolator(from.constData(), to.constData(), progress);
+ if (interpolator)
+ return interpolator(from.constData(), to.constData(), progress);
+ else
+ return QVariant();
}
//convert a variant from string type to another animatable type
-void QmlVariantAnimationPrivate::convertVariant(QVariant &variant, QVariant::Type type)
+//### should use any registered string convertor
+//### profile and optimize
+void QmlPropertyAnimationPrivate::convertVariant(QVariant &variant, QVariant::Type type)
{
if (variant.type() != QVariant::String) {
variant.convert(type);
@@ -2014,9 +1493,9 @@ void QmlVariantAnimationPrivate::convertVariant(QVariant &variant, QVariant::Typ
}
/*!
- \qmlclass VariantAnimation QmlVariantAnimation
+ \qmlclass PropertyAnimation QmlPropertyAnimation
\inherits Animation
- \brief The VariantAnimation allows you to animate changes in properties of type QVariant.
+ \brief The PropertyAnimation allows you to animate property changes.
Animate a size property over 200ms, from its current size to 20-by-20:
\code
@@ -2024,51 +1503,51 @@ void QmlVariantAnimationPrivate::convertVariant(QVariant &variant, QVariant::Typ
\endcode
*/
-QmlVariantAnimation::QmlVariantAnimation(QObject *parent)
-: QmlAbstractAnimation(*(new QmlVariantAnimationPrivate), parent)
+QmlPropertyAnimation::QmlPropertyAnimation(QObject *parent)
+: QmlAbstractAnimation(*(new QmlPropertyAnimationPrivate), parent)
{
- Q_D(QmlVariantAnimation);
+ Q_D(QmlPropertyAnimation);
d->init();
}
-QmlVariantAnimation::~QmlVariantAnimation()
+QmlPropertyAnimation::~QmlPropertyAnimation()
{
}
-void QmlVariantAnimationPrivate::init()
+void QmlPropertyAnimationPrivate::init()
{
- Q_Q(QmlVariantAnimation);
+ Q_Q(QmlPropertyAnimation);
va = new QmlTimeLineValueAnimator(q);
va->setStartValue(QVariant(0.0f));
va->setEndValue(QVariant(1.0f));
}
/*!
- \qmlproperty int VariantAnimation::duration
+ \qmlproperty int PropertyAnimation::duration
This property holds the duration of the transition, in milliseconds.
The default value is 250.
*/
/*!
- \property QmlVariantAnimation::duration
+ \property QmlPropertyAnimation::duration
\brief the duration of the transition, in milliseconds.
The default value is 250.
*/
-int QmlVariantAnimation::duration() const
+int QmlPropertyAnimation::duration() const
{
- Q_D(const QmlVariantAnimation);
+ Q_D(const QmlPropertyAnimation);
return d->va->duration();
}
-void QmlVariantAnimation::setDuration(int duration)
+void QmlPropertyAnimation::setDuration(int duration)
{
if (duration < 0) {
- qWarning("QmlVariantAnimation: Cannot set a duration of < 0");
+ qWarning("QmlPropertyAnimation: Cannot set a duration of < 0");
return;
}
- Q_D(QmlVariantAnimation);
+ Q_D(QmlPropertyAnimation);
if (d->va->duration() == duration)
return;
d->va->setDuration(duration);
@@ -2076,23 +1555,23 @@ void QmlVariantAnimation::setDuration(int duration)
}
/*!
- \qmlproperty real VariantAnimation::from
+ \qmlproperty real PropertyAnimation::from
This property holds the starting value.
If not set, then the value defined in the start state of the transition.
*/
/*!
- \property QmlVariantAnimation::from
+ \property QmlPropertyAnimation::from
\brief the starting value.
*/
-QVariant QmlVariantAnimation::from() const
+QVariant QmlPropertyAnimation::from() const
{
- Q_D(const QmlVariantAnimation);
+ Q_D(const QmlPropertyAnimation);
return d->from;
}
-void QmlVariantAnimation::setFrom(const QVariant &f)
+void QmlPropertyAnimation::setFrom(const QVariant &f)
{
- Q_D(QmlVariantAnimation);
+ Q_D(QmlPropertyAnimation);
if (d->fromIsDefined && f == d->from)
return;
d->from = f;
@@ -2101,23 +1580,23 @@ void QmlVariantAnimation::setFrom(const QVariant &f)
}
/*!
- \qmlproperty real VariantAnimation::to
+ \qmlproperty real PropertyAnimation::to
This property holds the ending value.
If not set, then the value defined in the end state of the transition.
*/
/*!
- \property QmlVariantAnimation::to
+ \property QmlPropertyAnimation::to
\brief the ending value.
*/
-QVariant QmlVariantAnimation::to() const
+QVariant QmlPropertyAnimation::to() const
{
- Q_D(const QmlVariantAnimation);
+ Q_D(const QmlPropertyAnimation);
return d->to;
}
-void QmlVariantAnimation::setTo(const QVariant &t)
+void QmlPropertyAnimation::setTo(const QVariant &t)
{
- Q_D(QmlVariantAnimation);
+ Q_D(QmlPropertyAnimation);
if (d->toIsDefined && t == d->to)
return;
d->to = t;
@@ -2126,28 +1605,71 @@ void QmlVariantAnimation::setTo(const QVariant &t)
}
/*!
- \qmlproperty string VariantAnimation::easing
- This property holds the easing curve used for the transition.
+ \qmlproperty string PropertyAnimation::easing
+ \brief the easing curve used for the transition.
- See NumericAnimation::easing for a full discussion of easing,
- and a list of available curves.
+ Available values are:
+
+ \list
+ \i \e easeNone - Easing equation function for a simple linear tweening, with no easing.
+ \i \e easeInQuad - Easing equation function for a quadratic (t^2) easing in: accelerating from zero velocity.
+ \i \e easeOutQuad - Easing equation function for a quadratic (t^2) easing out: decelerating to zero velocity.
+ \i \e easeInOutQuad - Easing equation function for a quadratic (t^2) easing in/out: acceleration until halfway, then deceleration.
+ \i \e easeOutInQuad - Easing equation function for a quadratic (t^2) easing out/in: deceleration until halfway, then acceleration.
+ \i \e easeInCubic - Easing equation function for a cubic (t^3) easing in: accelerating from zero velocity.
+ \i \e easeOutCubic - Easing equation function for a cubic (t^3) easing out: decelerating from zero velocity.
+ \i \e easeInOutCubic - Easing equation function for a cubic (t^3) easing in/out: acceleration until halfway, then deceleration.
+ \i \e easeOutInCubic - Easing equation function for a cubic (t^3) easing out/in: deceleration until halfway, then acceleration.
+ \i \e easeInQuart - Easing equation function for a quartic (t^4) easing in: accelerating from zero velocity.
+ \i \e easeOutQuart - Easing equation function for a quartic (t^4) easing out: decelerating from zero velocity.
+ \i \e easeInOutQuart - Easing equation function for a quartic (t^4) easing in/out: acceleration until halfway, then deceleration.
+ \i \e easeOutInQuart - Easing equation function for a quartic (t^4) easing out/in: deceleration until halfway, then acceleration.
+ \i \e easeInQuint - Easing equation function for a quintic (t^5) easing in: accelerating from zero velocity.
+ \i \e easeOutQuint - Easing equation function for a quintic (t^5) easing out: decelerating from zero velocity.
+ \i \e easeInOutQuint - Easing equation function for a quintic (t^5) easing in/out: acceleration until halfway, then deceleration.
+ \i \e easeOutInQuint - Easing equation function for a quintic (t^5) easing out/in: deceleration until halfway, then acceleration.
+ \i \e easeInSine - Easing equation function for a sinusoidal (sin(t)) easing in: accelerating from zero velocity.
+ \i \e easeOutSine - Easing equation function for a sinusoidal (sin(t)) easing out: decelerating from zero velocity.
+ \i \e easeInOutSine - Easing equation function for a sinusoidal (sin(t)) easing in/out: acceleration until halfway, then deceleration.
+ \i \e easeOutInSine - Easing equation function for a sinusoidal (sin(t)) easing out/in: deceleration until halfway, then acceleration.
+ \i \e easeInExpo - Easing equation function for an exponential (2^t) easing in: accelerating from zero velocity.
+ \i \e easeOutExpo - Easing equation function for an exponential (2^t) easing out: decelerating from zero velocity.
+ \i \e easeInOutExpo - Easing equation function for an exponential (2^t) easing in/out: acceleration until halfway, then deceleration.
+ \i \e easeOutInExpo - Easing equation function for an exponential (2^t) easing out/in: deceleration until halfway, then acceleration.
+ \i \e easeInCirc - Easing equation function for a circular (sqrt(1-t^2)) easing in: accelerating from zero velocity.
+ \i \e easeOutCirc - Easing equation function for a circular (sqrt(1-t^2)) easing out: decelerating from zero velocity.
+ \i \e easeInOutCirc - Easing equation function for a circular (sqrt(1-t^2)) easing in/out: acceleration until halfway, then deceleration.
+ \i \e easeOutInCirc - Easing equation function for a circular (sqrt(1-t^2)) easing out/in: deceleration until halfway, then acceleration.
+ \i \e easeInElastic - Easing equation function for an elastic (exponentially decaying sine wave) easing in: accelerating from zero velocity. The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter.
+ \i \e easeOutElastic - Easing equation function for an elastic (exponentially decaying sine wave) easing out: decelerating from zero velocity. The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter.
+ \i \e easeInOutElastic - Easing equation function for an elastic (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration.
+ \i \e easeOutInElastic - Easing equation function for an elastic (exponentially decaying sine wave) easing out/in: deceleration until halfway, then acceleration.
+ \i \e easeInBack - Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity.
+ \i \e easeOutBack - Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out: decelerating from zero velocity.
+ \i \e easeInOutBack - Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration.
+ \i \e easeOutInBack - Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration.
+ \i \e easeOutBounce - Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity.
+ \i \e easeInBounce - Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity.
+ \i \e easeInOutBounce - Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration.
+ \i \e easeOutInBounce - Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out/in: deceleration until halfway, then acceleration.
+ \endlist
*/
/*!
- \property QmlVariantAnimation::easing
+ \property QmlPropertyAnimation::easing
\brief the easing curve to use.
\sa QEasingCurve
*/
-QString QmlVariantAnimation::easing() const
+QString QmlPropertyAnimation::easing() const
{
- Q_D(const QmlVariantAnimation);
+ Q_D(const QmlPropertyAnimation);
return d->easing;
}
-void QmlVariantAnimation::setEasing(const QString &e)
+void QmlPropertyAnimation::setEasing(const QString &e)
{
- Q_D(QmlVariantAnimation);
+ Q_D(QmlPropertyAnimation);
if (d->easing == e)
return;
@@ -2157,28 +1679,28 @@ void QmlVariantAnimation::setEasing(const QString &e)
}
/*!
- \qmlproperty string VariantAnimation::properties
+ \qmlproperty string PropertyAnimation::properties
This property holds the properties this animation should be applied to.
This is a comma-separated list of properties that should use
this animation when they change.
*/
/*!
- \property QmlVariantAnimation::properties
+ \property QmlPropertyAnimation::properties
\brief the properties this animation should be applied to
properties holds a copy separated list of properties that should use
this animation when they change.
*/
-QString QmlVariantAnimation::properties() const
+QString QmlPropertyAnimation::properties() const
{
- Q_D(const QmlVariantAnimation);
+ Q_D(const QmlPropertyAnimation);
return d->properties;
}
-void QmlVariantAnimation::setProperties(const QString &prop)
+void QmlPropertyAnimation::setProperties(const QString &prop)
{
- Q_D(QmlVariantAnimation);
+ Q_D(QmlPropertyAnimation);
if (d->properties == prop)
return;
@@ -2187,32 +1709,33 @@ void QmlVariantAnimation::setProperties(const QString &prop)
}
/*!
- \qmlproperty list<Item> VariantAnimation::filter
+ \qmlproperty list<Item> PropertyAnimation::filter
This property holds the items selected to be affected by this animation (all if not set).
\sa exclude
*/
-QList<QObject *> *QmlVariantAnimation::filter()
+QList<QObject *> *QmlPropertyAnimation::filter()
{
- Q_D(QmlVariantAnimation);
+ Q_D(QmlPropertyAnimation);
return &d->filter;
}
/*!
- \qmlproperty list<Item> VariantAnimation::exclude
+ \qmlproperty list<Item> PropertyAnimation::exclude
This property holds the items not to be affected by this animation.
\sa filter
*/
-QList<QObject *> *QmlVariantAnimation::exclude()
+QList<QObject *> *QmlPropertyAnimation::exclude()
{
- Q_D(QmlVariantAnimation);
+ Q_D(QmlPropertyAnimation);
return &d->exclude;
}
-void QmlVariantAnimationPrivate::valueChanged(qreal r)
+void QmlPropertyAnimationPrivate::valueChanged(qreal r)
{
if (!fromSourced) {
if (!fromIsDefined) {
from = property.read();
+ convertVariant(from, (QVariant::Type)(interpolatorType ? interpolatorType : property.propertyType()));
}
fromSourced = true;
}
@@ -2220,28 +1743,30 @@ void QmlVariantAnimationPrivate::valueChanged(qreal r)
if (r == 1.) {
property.write(to);
} else {
- QVariant val = interpolateVariant(from, to, r);
- property.write(val);
+ if (interpolator)
+ property.write(interpolator(from.constData(), to.constData(), r));
+ else
+ property.write(interpolateVariant(from, to, r)); //### optimize
}
}
-QAbstractAnimation *QmlVariantAnimation::qtAnimation()
+QAbstractAnimation *QmlPropertyAnimation::qtAnimation()
{
- Q_D(QmlVariantAnimation);
+ Q_D(QmlPropertyAnimation);
return d->va;
}
-void QmlVariantAnimation::prepare(QmlMetaProperty &p)
+void QmlPropertyAnimation::prepare(QmlMetaProperty &p)
{
- Q_D(QmlVariantAnimation);
+ Q_D(QmlPropertyAnimation);
if (d->userProperty.isNull)
d->property = p;
else
d->property = d->userProperty;
- d->convertVariant(d->to, (QVariant::Type)d->property.propertyType());
+ d->convertVariant(d->to, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : d->property.propertyType()));
if (d->fromIsDefined)
- d->convertVariant(d->from, (QVariant::Type)d->property.propertyType());
+ d->convertVariant(d->from, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : d->property.propertyType()));
d->fromSourced = false;
d->value.QmlTimeLineValue::setValue(0.);
@@ -2249,44 +1774,66 @@ void QmlVariantAnimation::prepare(QmlMetaProperty &p)
d->va->setFromSourcedValue(&d->fromSourced);
}
-void QmlVariantAnimation::transition(QmlStateActions &actions,
+void QmlPropertyAnimation::transition(QmlStateActions &actions,
QmlMetaProperties &modified,
TransitionDirection direction)
{
- Q_D(QmlVariantAnimation);
+ Q_D(QmlPropertyAnimation);
Q_UNUSED(direction);
- struct NTransitionData : public QmlTimeLineValue
+ struct PropertyUpdater : public QmlTimeLineValue
{
QmlStateActions actions;
+ int interpolatorType; //for Number/ColorAnimation
+ int prevInterpolatorType; //for generic
+ QVariantAnimation::Interpolator interpolator;
void setValue(qreal v)
{
QmlTimeLineValue::setValue(v);
for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
+ QmlBehaviour::_ignore = true;
if (v == 1.)
action.property.write(action.toValue);
else {
if (action.fromValue.isNull()) {
action.fromValue = action.property.read();
- /*if (action.fromValue.isNull())
- action.fromValue = QVariant(0.);*/ //XXX can we give a default value for any type?
+ if (interpolatorType)
+ QmlPropertyAnimationPrivate::convertVariant(action.fromValue, (QVariant::Type)interpolatorType);
}
- QVariant val = QmlVariantAnimationPrivate::interpolateVariant(action.fromValue, action.toValue, v);
- action.property.write(val);
+ if (!interpolatorType) {
+ int propType = action.property.propertyType();
+ if (!prevInterpolatorType || prevInterpolatorType != propType) {
+ prevInterpolatorType = propType;
+ interpolator = QVariantAnimationPrivate::getInterpolator(prevInterpolatorType);
+ }
+ }
+ if (interpolator)
+ action.property.write(interpolator(action.fromValue.constData(), action.toValue.constData(), v));
}
+ QmlBehaviour::_ignore = false;
}
}
};
- QStringList props = d->properties.split(QLatin1Char(','));
+ QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(','));
for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
- NTransitionData *data = new NTransitionData;
+ /* ### we used to select properties of name 'color' by default for color animations
+ props << QLatin1String("color");*/
+
+ if (d->userProperty.isValid() && props.isEmpty() && !target()) {
+ props.append(d->userProperty.value.name());
+ d->target = d->userProperty.value.object();
+ }
+
+ PropertyUpdater *data = new PropertyUpdater;
+ data->interpolatorType = d->interpolatorType;
+ data->interpolator = d->interpolator;
QSet<QObject *> objs;
for (int ii = 0; ii < actions.count(); ++ii) {
@@ -2309,8 +1856,8 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
if (d->toIsDefined)
myAction.toValue = d->to;
- d->convertVariant(myAction.fromValue, (QVariant::Type)myAction.property.propertyType());
- d->convertVariant(myAction.toValue, (QVariant::Type)myAction.property.propertyType());
+ d->convertVariant(myAction.fromValue, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()));
+ d->convertVariant(myAction.toValue, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()));
modified << action.property;
@@ -2326,14 +1873,11 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
myAction.property = QmlMetaProperty(obj, props.at(jj));
if (d->fromIsDefined) {
- d->convertVariant(d->from, (QVariant::Type)myAction.property.propertyType());
+ d->convertVariant(d->from, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()));
myAction.fromValue = d->from;
}
-
- d->convertVariant(d->to, (QVariant::Type)myAction.property.propertyType());
+ d->convertVariant(d->to, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()));
myAction.toValue = d->to;
- myAction.bv = 0;
- myAction.event = 0;
data->actions << myAction;
}
}
@@ -2345,7 +1889,6 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
}
}
-//XXX whats the best name for this? (just Animation?)
-QML_DEFINE_TYPE(QmlVariantAnimation,VariantAnimation)
+QML_DEFINE_TYPE(QmlPropertyAnimation,PropertyAnimation)
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlanimation.h b/src/declarative/util/qmlanimation.h
index 0452159..110c43e 100644
--- a/src/declarative/util/qmlanimation.h
+++ b/src/declarative/util/qmlanimation.h
@@ -86,6 +86,9 @@ public:
bool repeat() const;
void setRepeat(bool);
+ int currentTime();
+ void setCurrentTime(int);
+
QmlAnimationGroup *group() const;
void setGroup(QmlAnimationGroup *);
@@ -157,53 +160,6 @@ protected:
};
QML_DECLARE_TYPE(QmlPauseAnimation)
-class QmlColorAnimationPrivate;
-class QmlColorAnimation : public QmlAbstractAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlColorAnimation)
- Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
- Q_PROPERTY(QColor from READ from WRITE setFrom NOTIFY fromChanged)
- Q_PROPERTY(QColor to READ to WRITE setTo NOTIFY toChanged)
- Q_PROPERTY(QString easing READ easing WRITE setEasing NOTIFY easingChanged)
- Q_PROPERTY(QList<QObject *>* filter READ filter)
- Q_PROPERTY(QList<QObject *>* exclude READ exclude)
-
-public:
- QmlColorAnimation(QObject *parent=0);
- virtual ~QmlColorAnimation();
-
- int duration() const;
- void setDuration(int);
-
- QColor from() const;
- void setFrom(const QColor &);
-
- QColor to() const;
- void setTo(const QColor &);
-
- QString easing() const;
- void setEasing(const QString &);
-
- QList<QObject *> *filter();
-
- QList<QObject *> *exclude();
-
-protected:
- virtual void transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
- TransitionDirection direction);
- virtual QAbstractAnimation *qtAnimation();
- virtual void prepare(QmlMetaProperty &);
-
-Q_SIGNALS:
- void durationChanged(int);
- void fromChanged(const QColor &);
- void toChanged(const QColor &);
- void easingChanged(const QString &);
-};
-QML_DECLARE_TYPE(QmlColorAnimation)
-
class QmlRunScriptActionPrivate;
class QmlRunScriptAction : public QmlAbstractAnimation
{
@@ -290,32 +246,32 @@ protected:
};
QML_DECLARE_TYPE(QmlParentChangeAction)
-class QmlNumericAnimationPrivate;
-class QmlNumericAnimation : public QmlAbstractAnimation
+class QmlPropertyAnimationPrivate;
+class QmlPropertyAnimation : public QmlAbstractAnimation
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlNumericAnimation)
+ Q_DECLARE_PRIVATE(QmlPropertyAnimation)
Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
- Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged)
- Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged)
+ Q_PROPERTY(QVariant from READ from WRITE setFrom NOTIFY fromChanged)
+ Q_PROPERTY(QVariant to READ to WRITE setTo NOTIFY toChanged)
Q_PROPERTY(QString easing READ easing WRITE setEasing NOTIFY easingChanged)
Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged)
Q_PROPERTY(QList<QObject *>* filter READ filter)
Q_PROPERTY(QList<QObject *>* exclude READ exclude)
public:
- QmlNumericAnimation(QObject *parent=0);
- virtual ~QmlNumericAnimation();
+ QmlPropertyAnimation(QObject *parent=0);
+ virtual ~QmlPropertyAnimation();
int duration() const;
void setDuration(int);
- qreal from() const;
- void setFrom(qreal);
+ QVariant from() const;
+ void setFrom(const QVariant &);
- qreal to() const;
- void setTo(qreal);
+ QVariant to() const;
+ void setTo(const QVariant &);
QString easing() const;
void setEasing(const QString &);
@@ -335,19 +291,51 @@ protected:
Q_SIGNALS:
void durationChanged(int);
- void fromChanged(qreal);
- void toChanged(qreal);
+ void fromChanged(QVariant);
+ void toChanged(QVariant);
void easingChanged(const QString &);
void propertiesChanged(const QString &);
};
-QML_DECLARE_TYPE(QmlNumericAnimation)
+QML_DECLARE_TYPE(QmlPropertyAnimation)
+
+class QmlColorAnimation : public QmlPropertyAnimation
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QmlPropertyAnimation)
+ Q_PROPERTY(QColor from READ from WRITE setFrom NOTIFY fromChanged)
+ Q_PROPERTY(QColor to READ to WRITE setTo NOTIFY toChanged)
+
+public:
+ QmlColorAnimation(QObject *parent=0);
+ virtual ~QmlColorAnimation();
+
+ QColor from() const;
+ void setFrom(const QColor &);
+
+ QColor to() const;
+ void setTo(const QColor &);
+};
+QML_DECLARE_TYPE(QmlColorAnimation)
-#if 0
-class QmlDiscreteAnimation : public QmlAbstractAnimation
+class QmlNumberAnimation : public QmlPropertyAnimation
{
-Q_OBJECT
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QmlPropertyAnimation)
+
+ Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged)
+ Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged)
+
+public:
+ QmlNumberAnimation(QObject *parent=0);
+ virtual ~QmlNumberAnimation();
+
+ qreal from() const;
+ void setFrom(qreal);
+
+ qreal to() const;
+ void setTo(qreal);
};
-#endif
+QML_DECLARE_TYPE(QmlNumberAnimation)
class QmlAnimationGroupPrivate;
class QmlAnimationGroup : public QmlAbstractAnimation
@@ -401,58 +389,6 @@ protected:
};
QML_DECLARE_TYPE(QmlParallelAnimation)
-class QmlVariantAnimationPrivate;
-class QmlVariantAnimation : public QmlAbstractAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlVariantAnimation)
-
- Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
- Q_PROPERTY(QVariant from READ from WRITE setFrom NOTIFY fromChanged)
- Q_PROPERTY(QVariant to READ to WRITE setTo NOTIFY toChanged)
- Q_PROPERTY(QString easing READ easing WRITE setEasing NOTIFY easingChanged)
- Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged)
- Q_PROPERTY(QList<QObject *>* filter READ filter)
- Q_PROPERTY(QList<QObject *>* exclude READ exclude)
-
-public:
- QmlVariantAnimation(QObject *parent=0);
- virtual ~QmlVariantAnimation();
-
- int duration() const;
- void setDuration(int);
-
- QVariant from() const;
- void setFrom(const QVariant &);
-
- QVariant to() const;
- void setTo(const QVariant &);
-
- QString easing() const;
- void setEasing(const QString &);
-
- QString properties() const;
- void setProperties(const QString &);
-
- QList<QObject *> *filter();
- QList<QObject *> *exclude();
-
-protected:
- virtual void transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
- TransitionDirection direction);
- virtual QAbstractAnimation *qtAnimation();
- virtual void prepare(QmlMetaProperty &);
-
-Q_SIGNALS:
- void durationChanged(int);
- void fromChanged(QVariant);
- void toChanged(QVariant);
- void easingChanged(const QString &);
- void propertiesChanged(const QString &);
-};
-QML_DECLARE_TYPE(QmlVariantAnimation)
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h
index f09ab88..da5ed97 100644
--- a/src/declarative/util/qmlanimation_p.h
+++ b/src/declarative/util/qmlanimation_p.h
@@ -207,40 +207,6 @@ public:
QPauseAnimation *pa;
};
-class QmlColorAnimationPrivate : public QmlAbstractAnimationPrivate
-{
- Q_DECLARE_PUBLIC(QmlColorAnimation)
-public:
- QmlColorAnimationPrivate()
- : QmlAbstractAnimationPrivate(), fromSourced(false), fromIsDefined(false), toIsDefined(false),
- ca(0), value(this, &QmlColorAnimationPrivate::valueChanged)
- {
- if (!colorInterpolator)
- colorInterpolator = QVariantAnimationPrivate::getInterpolator(QVariant::Color);
- }
-
- void init();
-
- QString easing;
-
- QColor fromValue;
- QColor toValue;
-
- QList<QObject *> filter;
- QList<QObject *> exclude;
-
- bool fromSourced;
- bool fromIsDefined;
- bool toIsDefined;
-
- QmlTimeLineValueAnimator *ca;
- virtual void valueChanged(qreal);
-
- QmlTimeLineValueProxy<QmlColorAnimationPrivate> value;
-
- static QVariantAnimation::Interpolator colorInterpolator;
-};
-
class QmlRunScriptActionPrivate : public QmlAbstractAnimationPrivate
{
Q_DECLARE_PUBLIC(QmlRunScriptAction)
@@ -295,32 +261,6 @@ public:
QActionAnimation *cpa;
};
-class QmlNumericAnimationPrivate : public QmlAbstractAnimationPrivate
-{
- Q_DECLARE_PUBLIC(QmlNumericAnimation)
-public:
- QmlNumericAnimationPrivate()
- : QmlAbstractAnimationPrivate(), fromSourced(false), na(0), value(this, &QmlNumericAnimationPrivate::valueChanged) {}
-
- void init();
-
- QmlNullableValue<qreal> from;
- QmlNullableValue<qreal> to;
-
- QString easing;
-
- QString properties;
- QList<QObject *> filter;
- QList<QObject *> exclude;
-
- bool fromSourced;
- qreal fromValue;
- QmlTimeLineValueAnimator *na;
- virtual void valueChanged(qreal);
-
- QmlTimeLineValueProxy<QmlNumericAnimationPrivate> value;
-};
-
class QmlAnimationGroupPrivate : public QmlAbstractAnimationPrivate
{
Q_DECLARE_PUBLIC(QmlAnimationGroup)
@@ -360,13 +300,13 @@ public:
QAnimationGroup *ag;
};
-class QmlVariantAnimationPrivate : public QmlAbstractAnimationPrivate
+class QmlPropertyAnimationPrivate : public QmlAbstractAnimationPrivate
{
- Q_DECLARE_PUBLIC(QmlVariantAnimation)
+ Q_DECLARE_PUBLIC(QmlPropertyAnimation)
public:
- QmlVariantAnimationPrivate()
+ QmlPropertyAnimationPrivate()
: QmlAbstractAnimationPrivate(), fromSourced(false), fromIsDefined(false), toIsDefined(false),
- va(0), value(this, &QmlVariantAnimationPrivate::valueChanged) {}
+ interpolatorType(0), interpolator(0), va(0), value(this, &QmlPropertyAnimationPrivate::valueChanged) {}
void init();
@@ -382,11 +322,13 @@ public:
bool fromSourced;
bool fromIsDefined;
bool toIsDefined;
+ int interpolatorType;
+ QVariantAnimation::Interpolator interpolator;
QmlTimeLineValueAnimator *va;
virtual void valueChanged(qreal);
- QmlTimeLineValueProxy<QmlVariantAnimationPrivate> value;
+ QmlTimeLineValueProxy<QmlPropertyAnimationPrivate> value;
static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress);
static void convertVariant(QVariant &variant, QVariant::Type type);
diff --git a/src/declarative/util/qmlfollow.cpp b/src/declarative/util/qmlfollow.cpp
index cf3d629..d3b3617 100644
--- a/src/declarative/util/qmlfollow.cpp
+++ b/src/declarative/util/qmlfollow.cpp
@@ -183,7 +183,7 @@ void QmlFollowPrivate::stop()
y: SequentialAnimation {
running: true
repeat: true
- NumericAnimation {
+ NumberAnimation {
to: 200
easing: "easeOutBounce(amplitude:100)"
duration: 2000
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/src/declarative/util/util.pri b/src/declarative/util/util.pri
index 030a44e..f35812c 100644
--- a/src/declarative/util/util.pri
+++ b/src/declarative/util/util.pri
@@ -6,7 +6,6 @@ SOURCES += \
util/qmlpackage.cpp \
util/qmlscript.cpp \
util/qmlanimation.cpp \
- util/qmlbehaviour.cpp \
util/qmlfont.cpp \
util/qmlfollow.cpp \
util/qmlstate.cpp\
@@ -14,8 +13,6 @@ SOURCES += \
util/qmlsetproperties.cpp \
util/qmlstategroup.cpp \
util/qmltransition.cpp \
- util/qbindablemap.cpp \
- util/qmldatetimeformatter.cpp \
util/qmllistmodel.cpp\
util/qmllistaccessor.cpp \
util/qmlopenmetaobject.cpp \
@@ -31,7 +28,6 @@ HEADERS += \
util/qmlscript.h \
util/qmlanimation.h \
util/qmlanimation_p.h \
- util/qmlbehaviour.h \
util/qmlfont.h \
util/qmlfollow.h \
util/qmlstate.h\
@@ -40,8 +36,6 @@ HEADERS += \
util/qmlstate_p.h\
util/qmlstategroup.h \
util/qmltransition.h \
- util/qbindablemap.h \
- util/qmldatetimeformatter.h \
util/qmllistmodel.h\
util/qmllistaccessor.h \
util/qmlopenmetaobject.h \
diff --git a/tests/auto/declarative/animations/animations.pro b/tests/auto/declarative/animations/animations.pro
new file mode 100644
index 0000000..419da4e
--- /dev/null
+++ b/tests/auto/declarative/animations/animations.pro
@@ -0,0 +1,5 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_animations.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/animations/data/badtype1.qml b/tests/auto/declarative/animations/data/badtype1.qml
new file mode 100644
index 0000000..691d2b3
--- /dev/null
+++ b/tests/auto/declarative/animations/data/badtype1.qml
@@ -0,0 +1,10 @@
+Rect {
+ width: 240
+ height: 320
+ Rect {
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ x: PropertyAnimation { from: "blue"; to: "green"; running: true; }
+ }
+}
diff --git a/tests/auto/declarative/animations/data/badtype2.qml b/tests/auto/declarative/animations/data/badtype2.qml
new file mode 100644
index 0000000..aa248a6
--- /dev/null
+++ b/tests/auto/declarative/animations/data/badtype2.qml
@@ -0,0 +1,10 @@
+Rect {
+ width: 240
+ height: 320
+ Rect {
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ x: NumberAnimation { from: "blue"; to: "green"; running: true; }
+ }
+}
diff --git a/tests/auto/declarative/animations/data/badtype3.qml b/tests/auto/declarative/animations/data/badtype3.qml
new file mode 100644
index 0000000..f1a89b6
--- /dev/null
+++ b/tests/auto/declarative/animations/data/badtype3.qml
@@ -0,0 +1,10 @@
+Rect {
+ width: 240
+ height: 320
+ Rect {
+ color: "red"
+ color: ColorAnimation { from: 10; to: 15; running: true; }
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+}
diff --git a/tests/auto/declarative/animations/data/badtype4.qml b/tests/auto/declarative/animations/data/badtype4.qml
new file mode 100644
index 0000000..fa4eebe
--- /dev/null
+++ b/tests/auto/declarative/animations/data/badtype4.qml
@@ -0,0 +1,23 @@
+Rect {
+ id: Wrapper
+ width: 240
+ height: 320
+ Rect {
+ id: MyRect
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: if (Wrapper.state == "state1") Wrapper.state = ""; else Wrapper.state = "state1";
+ }
+ }
+ states: State {
+ name: "state1"
+ SetProperties { target: MyRect; x: 200; color: "blue" }
+ }
+ transitions: Transition {
+ ColorAnimation { properties: "x,color"; duration: 1000 } //x is real, color is color
+ //NumberAnimation { properties: "x,color"; duration: 1000 } //x is real, color is color
+ }
+}
diff --git a/tests/auto/declarative/animations/data/color.qml b/tests/auto/declarative/animations/data/color.qml
new file mode 100644
index 0000000..051e0e1
--- /dev/null
+++ b/tests/auto/declarative/animations/data/color.qml
@@ -0,0 +1,10 @@
+Rect {
+ width: 240
+ height: 320
+ Rect {
+ color: "red"
+ color: PropertyAnimation { to: "green"; running: true }
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+}
diff --git a/tests/auto/declarative/animations/data/mixedtype1.qml b/tests/auto/declarative/animations/data/mixedtype1.qml
new file mode 100644
index 0000000..415bbfb
--- /dev/null
+++ b/tests/auto/declarative/animations/data/mixedtype1.qml
@@ -0,0 +1,22 @@
+Rect {
+ id: Wrapper
+ width: 240
+ height: 320
+ Rect {
+ id: MyRect
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: if (Wrapper.state == "state1") Wrapper.state = ""; else Wrapper.state = "state1";
+ }
+ }
+ states: State {
+ name: "state1"
+ SetProperties { target: MyRect; x: 200; width: 40 }
+ }
+ transitions: Transition {
+ PropertyAnimation { properties: "x,width"; duration: 1000 } //x is real, width is int
+ }
+}
diff --git a/tests/auto/declarative/animations/data/mixedtype2.qml b/tests/auto/declarative/animations/data/mixedtype2.qml
new file mode 100644
index 0000000..0e9fb8d
--- /dev/null
+++ b/tests/auto/declarative/animations/data/mixedtype2.qml
@@ -0,0 +1,22 @@
+Rect {
+ id: Wrapper
+ width: 240
+ height: 320
+ Rect {
+ id: MyRect
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: if (Wrapper.state == "state1") Wrapper.state = ""; else Wrapper.state = "state1";
+ }
+ }
+ states: State {
+ name: "state1"
+ SetProperties { target: MyRect; x: 200; color: "blue" }
+ }
+ transitions: Transition {
+ PropertyAnimation { properties: "x,color"; duration: 1000 } //x is real, color is color
+ }
+}
diff --git a/tests/auto/declarative/animations/data/number.qml b/tests/auto/declarative/animations/data/number.qml
new file mode 100644
index 0000000..feb551b
--- /dev/null
+++ b/tests/auto/declarative/animations/data/number.qml
@@ -0,0 +1,10 @@
+Rect {
+ width: 240
+ height: 320
+ Rect {
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ x: PropertyAnimation { from: 0; to: 200; duration: 1000; running: true }
+ }
+}
diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp
new file mode 100644
index 0000000..1895cef2
--- /dev/null
+++ b/tests/auto/declarative/animations/tst_animations.cpp
@@ -0,0 +1,82 @@
+#include <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qfxview.h>
+#include <QtDeclarative/qfxrect.h>
+
+class tst_animations : public QObject
+{
+ Q_OBJECT
+public:
+ tst_animations() {}
+
+private slots:
+ void badTypes();
+ //void mixedTypes();
+};
+
+void tst_animations::badTypes()
+{
+ //don't crash
+ {
+ QFxView *view = new QFxView;
+ view->setUrl(QUrl("file://" SRCDIR "/data/badtype1.qml"));
+
+ view->execute();
+ qApp->processEvents();
+
+ delete view;
+ }
+
+ //make sure we get a compiler error
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badtype2.qml"));
+ QTest::ignoreMessage(QtWarningMsg, "QmlComponent: Component is not ready");
+ c.create();
+
+ QVERIFY(c.errors().count() == 1);
+ QCOMPARE(c.errors().at(0).description(), QLatin1String("Cannot convert value \"blue\" to double number"));
+ }
+
+ //make sure we get a compiler error
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badtype3.qml"));
+ QTest::ignoreMessage(QtWarningMsg, "QmlComponent: Component is not ready");
+ c.create();
+
+ QVERIFY(c.errors().count() == 1);
+ QCOMPARE(c.errors().at(0).description(), QLatin1String("Cannot convert value \"10\" to color"));
+ }
+}
+
+/*//test animating mixed types with property animation
+ //for example, int + real; color + real; etc
+void tst_animations::mixedTypes()
+{
+ //### this one isn't real robust because width will likely change to real as well
+ {
+ QFxView *view = new QFxView;
+ view->setUrl(QUrl("file://" SRCDIR "/data/mixedtype1.qml"));
+
+ view->execute();
+ qApp->processEvents();
+
+ delete view;
+ }
+
+ {
+ QFxView *view = new QFxView;
+ view->setUrl(QUrl("file://" SRCDIR "/data/mixedtype2.qml"));
+
+ view->execute();
+ qApp->processEvents();
+
+ delete view;
+ }
+}*/
+
+QTEST_MAIN(tst_animations)
+
+#include "tst_animations.moc"
diff --git a/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml
index 61cedc2..69c5d81 100644
--- a/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml
+++ b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml
@@ -13,21 +13,19 @@ 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 = ''"
}
}
]
transitions: [
Transition {
- NumericAnimation {
+ NumberAnimation {
properties: "x"
}
}
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..7a58276 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
}
}
]
@@ -169,7 +167,7 @@ Rect {
fromState: "*"
toState: "to"
reversible: true
- NumericAnimation {
+ NumberAnimation {
properties: "x"
easing: type
}
diff --git a/tests/auto/declarative/visual/flipable/flipable.xml b/tests/auto/declarative/visual/flipable/flipable.xml
index d769e55..9288acc 100644
--- a/tests/auto/declarative/visual/flipable/flipable.xml
+++ b/tests/auto/declarative/visual/flipable/flipable.xml
@@ -104,17 +104,17 @@
</states>
<transitions>
<Transition fromState="*" toState="*">
- <NumericAnimation property="r" duration="500" />
+ <NumberAnimation property="r" duration="500" />
<SerialAnimation>
<SetPropertyAction target="{MeRect}" property="moveToParent" value="{Bounce}" />
<ParallelAnimation>
- <NumericAnimation target="{MeRect}" properties="x" to="0" duration="250" />
- <NumericAnimation target="{MeRect}" properties="y" to="0" easing="easeInQuad" duration="250"/>
+ <NumberAnimation target="{MeRect}" properties="x" to="0" duration="250" />
+ <NumberAnimation target="{MeRect}" properties="y" to="0" easing="easeInQuad" duration="250"/>
</ParallelAnimation>
<SetPropertyAction target="{MeRect}" property="moveToParent" />
<ParallelAnimation>
- <NumericAnimation target="{MeRect}" properties="x" to="0" duration="250"/>
- <NumericAnimation target="{MeRect}" properties="y" to="0" easing="easeOutQuad" duration="250"/>
+ <NumberAnimation target="{MeRect}" properties="x" to="0" duration="250"/>
+ <NumberAnimation target="{MeRect}" properties="y" to="0" easing="easeOutQuad" duration="250"/>
</ParallelAnimation>
</SerialAnimation>
</Transition>
diff --git a/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml b/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml
index 5c00f58..e0880f0 100644
--- a/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml
+++ b/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml
@@ -11,11 +11,11 @@ Rect {
y: SequentialAnimation {
running: true
repeat: true
- NumericAnimation {
+ NumberAnimation {
to: 0; duration: 500
easing: "easeInOutQuad"
}
- NumericAnimation {
+ NumberAnimation {
to: 200-img.height
easing: "easeOutBounce"
duration: 2000