aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/keyinteraction/focus/Core/ListMenu.qml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-09-17 18:10:59 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-02-11 19:26:05 +0100
commit90b4528b846542bfa6f0723487315140b9de17b4 (patch)
tree9356c0e6b5a736b3228ca6793416d927432c101e /examples/quick/keyinteraction/focus/Core/ListMenu.qml
parent38c03709236f6a2114ace7adf1b6bdcdfe8e4e18 (diff)
Avoid discouraged patterns in examples
In particular, use required properties where applicable, explicitly import QtQml where we use it, avoid unqualified access into the root scope of a component, use JavaScript functions with explicit parameters as signal handlers. Change-Id: I3eaaba47cc3c7a2a12d488e36f9eec145cedbb0e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'examples/quick/keyinteraction/focus/Core/ListMenu.qml')
-rw-r--r--examples/quick/keyinteraction/focus/Core/ListMenu.qml20
1 files changed, 12 insertions, 8 deletions
diff --git a/examples/quick/keyinteraction/focus/Core/ListMenu.qml b/examples/quick/keyinteraction/focus/Core/ListMenu.qml
index d8e9daba78..694ae3cac6 100644
--- a/examples/quick/keyinteraction/focus/Core/ListMenu.qml
+++ b/examples/quick/keyinteraction/focus/Core/ListMenu.qml
@@ -48,21 +48,22 @@
**
****************************************************************************/
+import QtQml 2.1
import QtQuick 2.1
FocusScope {
+ id: menu
clip: true
-
- onActiveFocusChanged: {
- if (activeFocus)
- mainView.state = "showListViews"
- }
+ required property Item keyUpTarget
+ required property Item keyLeftTarget
ListView {
id: list1
y: activeFocus ? 10 : 40; width: parent.width / 3; height: parent.height - 20
focus: true
- KeyNavigation.up: gridMenu; KeyNavigation.left: contextMenu; KeyNavigation.right: list2
+ KeyNavigation.up: menu.keyUpTarget
+ KeyNavigation.left: menu.keyLeftTarget
+ KeyNavigation.right: list2
model: 10; cacheBuffer: 200
delegate: ListViewDelegate {}
@@ -74,7 +75,9 @@ FocusScope {
ListView {
id: list2
y: activeFocus ? 10 : 40; x: parseInt(parent.width / 3); width: parent.width / 3; height: parent.height - 20
- KeyNavigation.up: gridMenu; KeyNavigation.left: list1; KeyNavigation.right: list3
+ KeyNavigation.up: menu.keyUpTarget
+ KeyNavigation.left: list1
+ KeyNavigation.right: list3
model: 10; cacheBuffer: 200
delegate: ListViewDelegate {}
@@ -86,7 +89,8 @@ FocusScope {
ListView {
id: list3
y: activeFocus ? 10 : 40; x: parseInt(2 * parent.width / 3); width: parent.width / 3; height: parent.height - 20
- KeyNavigation.up: gridMenu; KeyNavigation.left: list2
+ KeyNavigation.up: menu.keyUpTarget
+ KeyNavigation.left: list2
model: 10; cacheBuffer: 200
delegate: ListViewDelegate {}