demos/declarative/flickr/flickr.qml
changeset 37 758a864f9613
parent 30 5dc02b23752f
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
    55 
    55 
    56         Common.RssModel { id: rssModel }
    56         Common.RssModel { id: rssModel }
    57 
    57 
    58         Item {
    58         Item {
    59             id: views
    59             id: views
    60             x: 2; width: parent.width - 4
    60             width: parent.width
    61             anchors.top: titleBar.bottom; anchors.bottom: toolBar.top
    61             anchors.top: titleBar.bottom; anchors.bottom: toolBar.top
    62 
    62 
    63             Mobile.GridDelegate { id: gridDelegate }
       
    64             GridView {
    63             GridView {
    65                 x: (width/4-79)/2; y: x
    64                 id: photoGridView; model: rssModel; delegate: Mobile.GridDelegate {}
    66                 id: photoGridView; model: rssModel; delegate: gridDelegate; cacheBuffer: 100
    65                 cacheBuffer: 100
    67                 cellWidth: (parent.width-2)/4; cellHeight: cellWidth; width: parent.width; height: parent.height - 1; z: 6
    66                 cellWidth: (parent.width-2)/4; cellHeight: cellWidth; width: parent.width; height: parent.height
    68             }
    67             }
    69 
    68 
    70             Mobile.ListDelegate { id: listDelegate }
       
    71             ListView {
    69             ListView {
    72                 id: photoListView; model: rssModel; delegate: listDelegate; z: 6
    70                 id: photoListView; model: rssModel; delegate: Mobile.ListDelegate { }
    73                 width: parent.width; height: parent.height; x: -(parent.width * 1.5); cacheBuffer: 100;
    71                 width: parent.width; height: parent.height; x: -(parent.width * 1.5); cacheBuffer: 100;
    74             }
    72             }
       
    73 
    75             states: State {
    74             states: State {
    76                 name: "ListView"; when: screen.inListView == true
    75                 name: "ListView"; when: screen.inListView == true
    77                 PropertyChanges { target: photoListView; x: 0 }
    76                 PropertyChanges { target: photoListView; x: 0 }
    78                 PropertyChanges { target: photoGridView; x: -(parent.width * 1.5) }
    77                 PropertyChanges { target: photoGridView; x: -(parent.width * 1.5) }
    79             }
    78             }
    80 
    79 
    81             transitions: Transition {
    80             transitions: Transition {
    82                 NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad }
    81                 NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad }
    83             }
    82             }
       
    83 
       
    84             Mobile.ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height }
       
    85 
       
    86             Item { id: foreground; anchors.fill: parent }
    84         }
    87         }
    85 
    88 
    86         Mobile.ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height; z:1 }
    89         Mobile.TitleBar { id: titleBar; width: parent.width; height: 40; opacity: 0.9 }
    87         Mobile.TitleBar { id: titleBar; z: 5; width: parent.width; height: 40; opacity: 0.9 }
       
    88 
    90 
    89         Mobile.ToolBar {
    91         Mobile.ToolBar {
    90             id: toolBar; z: 5
    92             id: toolBar
    91             height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9
    93             height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9
    92             button1Label: "Update"; button2Label: "View mode"
    94             button1Label: "Update"; button2Label: "View mode"
    93             onButton1Clicked: rssModel.reload()
    95             onButton1Clicked: rssModel.reload()
    94             onButton2Clicked: if (screen.inListView == true) screen.inListView = false; else screen.inListView = true
    96             onButton2Clicked: if (screen.inListView == true) screen.inListView = false; else screen.inListView = true
    95         }
    97         }