summaryrefslogtreecommitdiffstats
path: root/examples/declarative/loader/Browser.diff
blob: adc0f6046419c22c4c43e66f19990bba2a8113ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
diff --git a/examples/declarative/loader/Browser.qml b/examples/declarative/loader/Browser.qml
index 96c2a76..00e1bb6 100644
--- a/examples/declarative/loader/Browser.qml
+++ b/examples/declarative/loader/Browser.qml
@@ -17,9 +17,16 @@ Rect {
         id: FolderDelegate
         Rect {
             id: Wrapper
+            function launch() {
+                if (folders.isFolder(index)) {
+                    folders.folder = filePath;
+                } else {
+                    qmlLauncher.launch(filePath);
+                }
+            }
             width: Root.width
             height: 32
-            color: activePalette.base
+            color: "transparent"
             Rect {
                 id: Highlight; visible: false
                 anchors.fill: parent
@@ -42,13 +49,7 @@ Rect {
             MouseRegion {
                 id: Mouse
                 anchors.fill: parent
-                onClicked: {
-                    if (folders.isFolder(index)) {
-                        folders.folder = filePath;
-                    } else {
-                        qmlLauncher.launch(filePath);
-                    }
-                }
+                onClicked: { launch() }
             }
             states: [
                 State {
@@ -69,13 +70,22 @@ Rect {
     }
 
     ListView {
+        id: View
         anchors.top: TitleBar.bottom
         anchors.left: parent.left
         anchors.right: parent.right
         anchors.bottom: parent.bottom
         model: folders
         delegate: FolderDelegate
+        highlight: Rect { color: "#FFFBAF" }
         clip: true
+        focus: true
+        onKeyPress: {
+            if (event.key == Qt.Key_Return || event.key == Qt.Key_Select) {
+                View.current.launch();
+                event.accepted = true;
+            }
+        }
     }
 
     Rect {