aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickitem2/data
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-10-01 21:09:52 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-01 12:25:04 +0100
commita7415035ed375d31e0e6d503ea8af43bf98d3fb7 (patch)
treed4dbc5212a855805c0967fca77aa06d4d515fedf /tests/auto/quick/qquickitem2/data
parent5b05a78d0055757adb3b2703ea990e07dbcd145a (diff)
KeyNavigation should use forceActiveFocus
It would only set focus which works fine as long as the target is in the same FocusScope. But as user one would expect that the target actually receives the focus. Using forceActiveFocus is sensible since the current item needs to have the "activeFocus" anyway and within the same focus scope setting focus=true on another item will take away the active focus. Task-number: QTBUG-34209 Change-Id: I824f15fd0d4d42eb2f0c6c1b02660f2e007b3362 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'tests/auto/quick/qquickitem2/data')
-rw-r--r--tests/auto/quick/qquickitem2/data/keynavigationtest_focusscope.qml93
1 files changed, 93 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickitem2/data/keynavigationtest_focusscope.qml b/tests/auto/quick/qquickitem2/data/keynavigationtest_focusscope.qml
new file mode 100644
index 0000000000..985086ff49
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/keynavigationtest_focusscope.qml
@@ -0,0 +1,93 @@
+import QtQuick 2.0
+
+Grid {
+ columns: 2
+ width: 100; height: 100
+ function verify() {
+ if (item1.KeyNavigation.right != item2)
+ return false;
+ if (item1.KeyNavigation.down != item3)
+ return false;
+ if (item1.KeyNavigation.tab != item2)
+ return false;
+ if (item1.KeyNavigation.backtab != item4)
+ return false;
+
+ if (item2.KeyNavigation.left != item1)
+ return false;
+ if (item2.KeyNavigation.down != item4)
+ return false;
+ if (item2.KeyNavigation.tab != item3)
+ return false;
+ if (item2.KeyNavigation.backtab != item1)
+ return false;
+
+ if (item3.KeyNavigation.right != item4)
+ return false;
+ if (item3.KeyNavigation.up != item1)
+ return false;
+ if (item3.KeyNavigation.tab != item4)
+ return false;
+ if (item3.KeyNavigation.backtab != item2)
+ return false;
+
+ if (item4.KeyNavigation.left != item3)
+ return false;
+ if (item4.KeyNavigation.up != item2)
+ return false;
+ if (item4.KeyNavigation.tab != item1)
+ return false;
+ if (item4.KeyNavigation.backtab != item3)
+ return false;
+
+ return true;
+ }
+
+ Rectangle {
+ id: item1
+ objectName: "item1"
+ focus: true
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.right: item2
+ KeyNavigation.down: item3
+ KeyNavigation.tab: item2
+ KeyNavigation.backtab: item4
+ }
+ FocusScope {
+ Rectangle {
+ id: item2
+ objectName: "item2"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.left: item1
+ KeyNavigation.down: item4
+ KeyNavigation.tab: item3
+ KeyNavigation.backtab: item1
+ }
+ }
+ FocusScope {
+ Rectangle {
+ id: item3
+ objectName: "item3"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.right: item4
+ KeyNavigation.up: item1
+ KeyNavigation.tab: item4
+ KeyNavigation.backtab: item2
+ }
+ FocusScope {
+ Rectangle {
+ id: item4
+ objectName: "item4"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.left: item3
+ KeyNavigation.up: item2
+ KeyNavigation.tab: item1
+ KeyNavigation.backtab: item3
+ }
+ }
+ }
+}