cfdc638c5868a36ecd24d713991292b78225790c
[pywienerlinien] / ui / Overview.qml
1
2 import Qt 4.7
3
4 Rectangle {
5     width: 800
6     height: 400
7     color: 'black'
8
9     property alias model: lv.model
10
11
12     ListView {
13         id: lv
14         anchors.fill: parent
15
16         delegate: OverviewItem {
17             onShowDetails: lv.showDetails(details)
18         }
19
20         states: [
21             State {
22                 name: 'overview'
23             },
24             State {
25                 name: 'details'
26                 PropertyChanges {
27                     target: detailsRect
28                     opacity: 1
29                     scale: 1
30                 }
31             }
32         ]
33
34         Rectangle {
35             id: detailsRect
36             width: parent.width - 50
37             height: parent.height - 50
38             anchors.centerIn: parent
39             scale: 0
40             opacity: 0
41             color: '#aaa'
42
43             border {
44                 color: '#888'
45                 width: 10
46             }
47
48             Behavior on opacity { PropertyAnimation { duration: 250 }}
49
50             Behavior on scale {
51                 PropertyAnimation {
52                     duration: 500
53                     easing.type: Easing.InCubic
54                 }
55             }
56
57             Text {
58                 id: detailsTitle
59
60                 anchors.left: parent.left
61                 anchors.right: parent.right
62                 anchors.top: parent.top
63                 horizontalAlignment: Text.AlignHCenter
64                 anchors.topMargin: 20
65                 font.pixelSize: 30
66             }
67
68             MouseArea {
69                 anchors.fill: parent
70                 onClicked: lv.state = 'overview'
71             }
72         }
73
74         function showDetails(details) {
75             detailsTitle.text = 'FIXME - show details for ' + details.time_from
76             lv.state = 'details'
77         }
78     }
79 }
80