Changeset View
Changeset View
Standalone View
Standalone View
lib/qml/ResultsView.qml
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | 79 | delegate: ResultDelegate { | |||
---|---|---|---|---|---|
81 | width: listView.width | 81 | width: listView.width | ||
82 | } | 82 | } | ||
83 | 83 | | |||
84 | // | 84 | // | ||
85 | // vHanda: Ideally this should have gotten handled in the delagte's onReturnPressed | 85 | // vHanda: Ideally this should have gotten handled in the delagte's onReturnPressed | ||
86 | // code, but the ListView doesn't seem forward keyboard events to the delgate when | 86 | // code, but the ListView doesn't seem forward keyboard events to the delgate when | ||
87 | // it is not in activeFocus. Even manually adding Keys.forwardTo: resultDelegate | 87 | // it is not in activeFocus. Even manually adding Keys.forwardTo: resultDelegate | ||
88 | // doesn't make any difference! | 88 | // doesn't make any difference! | ||
89 | Keys.onReturnPressed: runCurrentIndex(); | 89 | Keys.onReturnPressed: runCurrentIndex(event); | ||
90 | Keys.onEnterPressed: runCurrentIndex(); | 90 | Keys.onEnterPressed: runCurrentIndex(event); | ||
91 | 91 | | |||
92 | function runCurrentIndex() { | 92 | function runCurrentIndex(event) { | ||
93 | if (!currentItem) { | 93 | if (!currentItem) { | ||
94 | runAutomatically = true | 94 | runAutomatically = true | ||
95 | return; | 95 | return; | ||
96 | } else { | 96 | } else { | ||
97 | // If user presses Shift+Return to invoke an action, invoke the first runner action | ||||
98 | if (event && event.modifiers === Qt.ShiftModifier | ||||
99 | && currentItem.additionalActions && currentItem.additionalActions.length > 0) { | ||||
100 | runAction(0) | ||||
101 | return | ||||
102 | } | ||||
103 | | ||||
97 | if (currentItem.activeAction > -1) { | 104 | if (currentItem.activeAction > -1) { | ||
98 | runAction(currentItem.activeAction) | 105 | runAction(currentItem.activeAction) | ||
99 | return | 106 | return | ||
100 | } | 107 | } | ||
101 | 108 | | |||
102 | if (resultModel.run(currentIndex)) { | 109 | if (resultModel.run(currentIndex)) { | ||
103 | activated() | 110 | activated() | ||
104 | } | 111 | } | ||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |