Handle MouseArea.enabled = false after mouse is pressed.
[profile/ivi/qtdeclarative.git] / examples / qml / toys / clocks / clocks.qml
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the examples of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:BSD$
9 ** You may use this file under the terms of the BSD license as follows:
10 **
11 ** "Redistribution and use in source and binary forms, with or without
12 ** modification, are permitted provided that the following conditions are
13 ** met:
14 **   * Redistributions of source code must retain the above copyright
15 **     notice, this list of conditions and the following disclaimer.
16 **   * Redistributions in binary form must reproduce the above copyright
17 **     notice, this list of conditions and the following disclaimer in
18 **     the documentation and/or other materials provided with the
19 **     distribution.
20 **   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
21 **     the names of its contributors may be used to endorse or promote
22 **     products derived from this software without specific prior written
23 **     permission.
24 **
25 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40
41 import QtQuick 2.0
42 import "content"
43
44 Rectangle {
45     id: root
46     width: 640; height: 320
47     color: "#646464"
48
49     ListView {
50         id: clockview
51         anchors.fill: parent
52         orientation: ListView.Horizontal
53         cacheBuffer: 2000
54         snapMode: ListView.SnapOneItem
55         highlightRangeMode: ListView.ApplyRange
56
57         delegate: Clock { city: cityName; shift: timeShift }
58         model: ListModel {
59             ListElement { cityName: "New York"; timeShift: -4 }
60             ListElement { cityName: "London"; timeShift: 0 }
61             ListElement { cityName: "Oslo"; timeShift: 1 }
62             ListElement { cityName: "Mumbai"; timeShift: 5.5 }
63             ListElement { cityName: "Tokyo"; timeShift: 9 }
64             ListElement { cityName: "Brisbane"; timeShift: 10 }
65             ListElement { cityName: "Los Angeles"; timeShift: -8 }
66         }
67     }
68
69     Image {
70         anchors.left: parent.left
71         anchors.bottom: parent.bottom
72         anchors.margins: 10
73         source: "content/arrow.png"
74         rotation: -90
75         opacity: clockview.atXBeginning ? 0 : 0.5
76         Behavior on opacity { NumberAnimation { duration: 500 } }
77     }
78
79     Image {
80         anchors.right: parent.right
81         anchors.bottom: parent.bottom
82         anchors.margins: 10
83         source: "content/arrow.png"
84         rotation: 90
85         opacity: clockview.atXEnd ? 0 : 0.5
86         Behavior on opacity { NumberAnimation { duration: 500 } }
87     }
88 }