Initial import from the monolithic Qt.
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qdeclarativefocusscope / data / test4.qml
1 import QtQuick 1.0
2
3 Rectangle {
4     color: "white"
5     width: 800
6     height: 600
7
8     Keys.onDigit9Pressed: console.log("Error - Root")
9
10     FocusScope {
11         id: myScope
12
13         Keys.onDigit9Pressed: console.log("Error - FocusScope")
14
15         Rectangle {
16             objectName: "item0"
17             height: 120
18             width: 420
19
20             color: "transparent"
21             border.width: 5
22             border.color: myScope.activeFocus?"blue":"black"
23
24             Rectangle {
25                 id: item1; objectName: "item1"
26                 x: 10; y: 10
27                 width: 100; height: 100; color: "green"
28                 border.width: 5
29                 border.color: activeFocus?"blue":"black"
30                 Keys.onDigit9Pressed: console.log("Error - Top Left");
31                 KeyNavigation.right: item2
32                 focus: true
33
34                 Rectangle {
35                     width: 50; height: 50; anchors.centerIn: parent
36                     color: parent.activeFocus?"red":"transparent"
37                 }
38             }
39
40             Rectangle {
41                 id: item2; objectName: "item2"
42                 x: 310; y: 10
43                 width: 100; height: 100; color: "green"
44                 border.width: 5
45                 border.color: activeFocus?"blue":"black"
46                 KeyNavigation.left: item1
47                 Keys.onDigit9Pressed: console.log("Error - Top Right");
48
49                 Rectangle {
50                     width: 50; height: 50; anchors.centerIn: parent
51                     color: parent.activeFocus?"red":"transparent"
52                 }
53             }
54         }
55         KeyNavigation.down: item3
56     }
57
58     Text { x:100; y:170; text: "There should be no blue borders, or red squares.\nPressing \"9\" should do nothing.\nArrow keys should have no effect." }
59
60     Rectangle {
61         id: item3; objectName: "item3"
62         x: 10; y: 300
63         width: 100; height: 100; color: "green"
64         border.width: 5
65         border.color: activeFocus?"blue":"black"
66
67         Keys.onDigit9Pressed: console.log("Error - Bottom Left");
68         KeyNavigation.up: myScope
69
70         Rectangle {
71             width: 50; height: 50; anchors.centerIn: parent
72             color: parent.activeFocus?"red":"transparent"
73         }
74     }
75
76 }