diff options
author | Michael Bohlender <michael.bohlender@kdemail.net> | 2018-03-01 11:25:36 +0100 |
---|---|---|
committer | Michael Bohlender <michael.bohlender@kdemail.net> | 2018-03-01 11:25:36 +0100 |
commit | 48627975b967254c8fb2646716d2682a525a73f4 (patch) | |
tree | 132fb6ab7550ec1e432a80969a499ba1207c892c | |
parent | 6a9157e4971b03ceb156f641d974e1fed4b4226f (diff) | |
download | kube-48627975b967254c8fb2646716d2682a525a73f4.tar.gz kube-48627975b967254c8fb2646716d2682a525a73f4.zip |
some keyboard navigation
-rw-r--r-- | views/search/qml/View_new.qml | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/views/search/qml/View_new.qml b/views/search/qml/View_new.qml index f814ba76..61b89e7b 100644 --- a/views/search/qml/View_new.qml +++ b/views/search/qml/View_new.qml | |||
@@ -25,6 +25,8 @@ import org.kube.framework 1.0 as Kube | |||
25 | StackView { | 25 | StackView { |
26 | id: stack | 26 | id: stack |
27 | 27 | ||
28 | anchors.fill: parent | ||
29 | |||
28 | property var searchTerm: "" | 30 | property var searchTerm: "" |
29 | 31 | ||
30 | initialItem: searchBar | 32 | initialItem: searchBar |
@@ -32,26 +34,39 @@ StackView { | |||
32 | Component { | 34 | Component { |
33 | id: searchBar | 35 | id: searchBar |
34 | 36 | ||
35 | Rectangle { | 37 | FocusScope { |
36 | color: Kube.Colors.backgroundColor | ||
37 | 38 | ||
38 | Row { | 39 | function search() { |
39 | anchors.centerIn: parent | 40 | stack.searchTerm = searchField.text |
41 | stack.push(searchResults) | ||
42 | } | ||
40 | 43 | ||
41 | spacing: Kube.Units.smallSpacing | 44 | Rectangle { |
45 | anchors.fill: parent | ||
46 | color: Kube.Colors.backgroundColor | ||
42 | 47 | ||
43 | Kube.TextField { | 48 | Row { |
44 | id: searchField | 49 | anchors.centerIn: parent |
45 | width: Kube.Units.gridUnit * 30 | ||
46 | } | ||
47 | 50 | ||
48 | Kube.PositiveButton { | 51 | spacing: Kube.Units.smallSpacing |
49 | text: qsTr("Search") | ||
50 | enabled: searchField.text != "" | ||
51 | 52 | ||
52 | onClicked: { | 53 | Kube.TextField { |
53 | searchTerm = searchField.text | 54 | id: searchField |
54 | stack.push(searchResults) | 55 | width: Kube.Units.gridUnit * 30 |
56 | focus: true | ||
57 | text: stack.searchTerm | ||
58 | |||
59 | Keys.onEscapePressed: stack.searchTerm = "" | ||
60 | onAccepted: search() | ||
61 | } | ||
62 | |||
63 | Kube.PositiveButton { | ||
64 | text: qsTr("Search") | ||
65 | enabled: searchField.text != "" | ||
66 | |||
67 | onClicked: { | ||
68 | search() | ||
69 | } | ||
55 | } | 70 | } |
56 | } | 71 | } |
57 | } | 72 | } |
@@ -81,7 +96,10 @@ StackView { | |||
81 | leftMargin: Kube.Units.smallSpacing | 96 | leftMargin: Kube.Units.smallSpacing |
82 | } | 97 | } |
83 | iconName: Kube.Icons.goBack | 98 | iconName: Kube.Icons.goBack |
84 | onClicked: stack.pop() | 99 | onClicked: { |
100 | stack.searchTerm = "" | ||
101 | stack.pop() | ||
102 | } | ||
85 | } | 103 | } |
86 | 104 | ||
87 | Kube.TextField { | 105 | Kube.TextField { |