Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / tests / testapplications / elements / content / KeysElement.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 test suite of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 import QtQuick 2.0
43
44 Item {
45     id: keyselementtest
46     anchors.fill: parent
47     property string testtext: ""
48     property int sidelength: 1500
49     focus: true
50
51     Rectangle {
52         id: keyselementbox
53         color: "lightgray"; border.color: "gray"; radius: 5; clip: true; opacity: .7
54         height: 250; width: parent.width *.8
55         anchors.centerIn: parent
56         focus: true
57         Keys.enabled: true
58         Keys.onLeftPressed: { if (statenum == 2) { advance(); } }
59         Keys.onRightPressed: { if (statenum == 1) { advance(); } }
60         Keys.onUpPressed: { if (statenum == 3) { advance(); } }
61         Keys.onDownPressed: { if (statenum == 4) { advance(); } }
62         Keys.onPressed: {
63             if ((event.key == Qt.Key_Space) && (event.modifiers & Qt.ControlModifier) && (event.modifiers & Qt.AltModifier)) {
64                 if (statenum == 5) { advance(); }
65             }
66         }
67         Rectangle { id: leftone; height: 50; width: 50; color: "green"; anchors{ left: parent.left; verticalCenter: parent.verticalCenter } }
68         Rectangle { id: rightone; height: 50; width: 50; color: "green"; anchors{ right: parent.right; verticalCenter: parent.verticalCenter } }
69         Rectangle { id: topone; height: 50; width: 50; color: "green"; anchors{ top: parent.top; horizontalCenter: parent.horizontalCenter } }
70         Rectangle { id: bottomone; height: 50; width: 50; color: "green"; anchors{ bottom: parent.bottom; horizontalCenter: parent.horizontalCenter } }
71     }
72
73     SystemTestHelp { id: helpbubble; visible: statenum != 0
74         anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
75     }
76     BugPanel { id: bugpanel }
77
78     states: [
79         State { name: "start"; when: statenum == 1
80             PropertyChanges { target: helpbubble; showadvance: false }
81             PropertyChanges { target: keyselementtest
82                 testtext: "This is a Keys element. At present there should be four squares\n"+
83                 "Next, please press the right button on the keypad/board" }
84         },
85         State { name: "right"; when: statenum == 2
86             PropertyChanges { target: helpbubble; showadvance: false }
87             PropertyChanges { target: rightone; color: "orange" }
88             PropertyChanges { target: keyselementtest; testtext: "Good. Now press left." }
89         },
90         State { name: "left"; when: statenum == 3
91             PropertyChanges { target: helpbubble; showadvance: false }
92             PropertyChanges { target: leftone; color: "orange" }
93             PropertyChanges { target: keyselementtest; testtext: "Press up." }
94         },
95         State { name: "up"; when: statenum == 4
96             PropertyChanges { target: helpbubble; showadvance: false }
97             PropertyChanges { target: topone; color: "orange" }
98             PropertyChanges { target: keyselementtest; testtext: "And then press down" }
99         },
100         State { name: "down"; when: statenum == 5
101             PropertyChanges { target: helpbubble; showadvance: false }
102             PropertyChanges { target: bottomone; color: "orange" }
103             PropertyChanges { target: keyselementtest; testtext: "Excellent. Now hold Ctrl+Alt and press Space" }
104         },
105         State { name: "modifiers"; when: statenum == 6
106             PropertyChanges { target: helpbubble; showadvance: true }
107             PropertyChanges { target: keyselementbox; color: "orange" }
108             PropertyChanges { target: keyselementtest
109                 testtext: "Test has completed\n"+
110                 "Advance to restart the test." }
111         }
112     ]
113
114 }