From b6fa0efb754723fd3fe33254e322ad5d7bf1f19f Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 1 Sep 2009 12:15:25 +1000 Subject: Fix bugs in flick-mobile demo. --- demos/declarative/flickr/flickr-mobile.qml | 18 ++++++++++++++---- demos/declarative/flickr/mobile/GridDelegate.qml | 9 +++------ demos/declarative/flickr/mobile/TitleBar.qml | 3 ++- demos/declarative/flickr/mobile/ToolBar.qml | 10 ++++++---- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/demos/declarative/flickr/flickr-mobile.qml b/demos/declarative/flickr/flickr-mobile.qml index 643298d..c497e4e 100644 --- a/demos/declarative/flickr/flickr-mobile.qml +++ b/demos/declarative/flickr/flickr-mobile.qml @@ -31,9 +31,18 @@ Item { id: PhotoListView; model: RssModel; delegate: ListDelegate width: parent.width; height: parent.height; x: -(parent.width * 1.5); cacheBuffer: 100; } + states: State { + name: "ListView"; when: Screen.inListView == true + PropertyChanges { target: PhotoListView; x: 0 } + PropertyChanges { target: PhotoGridView; x: -(parent.width * 1.5) } + } + + transitions: Transition { + NumberAnimation { properties: "x"; duration: 500; easing: "easeInOutQuad" } + } } - Common.ImageDetails { id: ImageDetails; width: parent.width; x: parent.width; height: parent.height } + Common.ImageDetails { id: ImageDetails; width: parent.width; anchors.left: Views.right; height: parent.height } Mobile.TitleBar { id: TitleBar; width: parent.width; height: 40; opacity: 0.9 } Mobile.ToolBar { @@ -45,9 +54,10 @@ Item { } states: State { - name: "ListView"; when: Screen.inListView == true - PropertyChanges { target: PhotoListView; x: 0 } - PropertyChanges { target: PhotoGridView; x: -(parent.width * 1.5) } + name: "DetailedView" + PropertyChanges { target: Views; x: -parent.width } + PropertyChanges { target: ToolBar; button2Label: "Back" } + PropertyChanges { target: ToolBar; onButton2Clicked: { } } } transitions: Transition { diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml index 5ab4d3a..91e7c8d 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/mobile/GridDelegate.qml @@ -48,23 +48,20 @@ name: "Details"; extend: "Show" ParentChange { target: Wrapper; parent: ImageDetails.frontContainer } PropertyChanges { target: Wrapper; x: 20; y: 60 } - PropertyChanges { target: ImageDetails; x: 0 } - PropertyChanges { target: Views; x: -parent.width } - PropertyChanges { target: ToolBar.button2; text: "Back" } - PropertyChanges { target: ToolBar; onButton2Clicked: { } } + PropertyChanges { target: Background; state: "DetailedView" } } ] transitions: [ Transition { from: "Show"; to: "Details" ParentAction { } - NumberAnimation { properties: "x,y,opacity,angle"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" } }, Transition { from: "Details"; to: "Show" SequentialAnimation { ParentAction { } - NumberAnimation { properties: "x,y,opacity,angle"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" } PropertyAction { target: Wrapper; properties: "z" } } } diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml index b74e414..9d40323 100644 --- a/demos/declarative/flickr/mobile/TitleBar.qml +++ b/demos/declarative/flickr/mobile/TitleBar.qml @@ -13,8 +13,9 @@ Item { Script { function accept() { - RssModel.tags = Editor.text TitleBar.state = "" + Background.state = "" + RssModel.tags = Editor.text } } diff --git a/demos/declarative/flickr/mobile/ToolBar.qml b/demos/declarative/flickr/mobile/ToolBar.qml index 80897cc..8ac5127 100644 --- a/demos/declarative/flickr/mobile/ToolBar.qml +++ b/demos/declarative/flickr/mobile/ToolBar.qml @@ -3,20 +3,22 @@ import Qt 4.6 Item { id: Toolbar - property var button1Label - property var button2Label + property alias button1Label: Button1.text + property alias button2Label: Button2.text signal button1Clicked signal button2Clicked BorderImage { source: "images/titlebar2.sci"; width: parent.width; height: parent.height + 14; y: -7 } Button { - anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32; text: button1Label + id: Button1 + anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32 onClicked: Toolbar.button1Clicked() } Button { - anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32; text: button2Label + id: Button2 + anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32 onClicked: Toolbar.button2Clicked() } } -- cgit v0.12