summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/visual/Package_Views/packageviews.qml
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-11-13 04:49:40 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-11-13 04:49:40 (GMT)
commit14821863b830b85ccb29df217a52f1ca52c9c421 (patch)
tree472e41f9c7e54cc6c9ea1fe1d63218d2960876ea /tests/auto/declarative/visual/Package_Views/packageviews.qml
parentf2d9bdb36061b4b419e777075027f609bf9890b2 (diff)
parentf7b6358f0d8ff9cad1fd1fcb9622fad40cb0f0b0 (diff)
downloadQt-14821863b830b85ccb29df217a52f1ca52c9c421.zip
Qt-14821863b830b85ccb29df217a52f1ca52c9c421.tar.gz
Qt-14821863b830b85ccb29df217a52f1ca52c9c421.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts: doc/src/declarative/globalobject.qdoc
Diffstat (limited to 'tests/auto/declarative/visual/Package_Views/packageviews.qml')
-rw-r--r--tests/auto/declarative/visual/Package_Views/packageviews.qml81
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/auto/declarative/visual/Package_Views/packageviews.qml b/tests/auto/declarative/visual/Package_Views/packageviews.qml
new file mode 100644
index 0000000..a9719ca
--- /dev/null
+++ b/tests/auto/declarative/visual/Package_Views/packageviews.qml
@@ -0,0 +1,81 @@
+import Qt 4.6
+
+Rectangle {
+ id: root
+ width: 200
+ height: 200
+ color: "black"
+
+ VisualDataModel {
+ id: Model
+ model: ListModel {
+ ListElement { itemColor: "red" }
+ ListElement { itemColor: "green" }
+ ListElement { itemColor: "blue" }
+ ListElement { itemColor: "orange" }
+ ListElement { itemColor: "purple" }
+ ListElement { itemColor: "yellow" }
+ ListElement { itemColor: "slategrey" }
+ ListElement { itemColor: "cyan" }
+ }
+ delegate: Package {
+ Rectangle {
+ id: listItem; Package.name: "list"; width:root.width/2; height: 50; color: "transparent"; border.color: "white"
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: myState.state = myState.state == "list" ? "grid" : "list"
+ }
+ }
+ Rectangle {
+ id: gridItem; Package.name: "grid"; width:50; height: 50; color: "transparent"; border.color: "white"
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: myState.state = myState.state == "list" ? "grid" : "list"
+ }
+ }
+ Rectangle { id: myContent; width:50; height: 50; color: itemColor }
+
+ StateGroup {
+ id: myState
+ state: "list"
+ states: [
+ State {
+ name: "list"
+ ParentChange { target: myContent; parent: listItem }
+ PropertyChanges { target: myContent; x: 0; y: 0; width: listItem.width }
+ },
+ State {
+ name: "grid"
+ ParentChange { target: myContent; parent: gridItem }
+ PropertyChanges { target: myContent; x: 0; y: 0; width: gridItem.width }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "*"; to: "*"
+ SequentialAnimation {
+ ParentAction{}
+ NumberAnimation { matchProperties: "x,y,width"; easing: "easeInOutQuad" }
+ }
+ }
+ ]
+ }
+ }
+ }
+
+ ListView {
+ width: parent.width/2
+ height: parent.height
+ model: Model.parts.list
+ }
+
+ GridView {
+ x: parent.width/2
+ width: parent.width/2
+ cellWidth: 50
+ cellHeight: 50
+ height: parent.height
+ model: Model.parts.grid
+ }
+}