From afd8f59b8975224dcf643211be513690ae2f7b64 Mon Sep 17 00:00:00 2001 From: Yari Polla Date: Mon, 20 Mar 2023 15:05:13 +0100 Subject: [PATCH] milou: make possible to use keyboard and fix scrolling --- .../qml/widgets/krunner/KRunnerWidget.qml | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/components/mobileshell/qml/widgets/krunner/KRunnerWidget.qml b/components/mobileshell/qml/widgets/krunner/KRunnerWidget.qml index 727472b8..9f9d4309 100644 --- a/components/mobileshell/qml/widgets/krunner/KRunnerWidget.qml +++ b/components/mobileshell/qml/widgets/krunner/KRunnerWidget.qml @@ -79,6 +79,12 @@ Item { } } + Keys.onPressed: event => { + if (event.key === Qt.Key_Down) { + listView.forceActiveFocus(); + } + } + Flickable { id: flickable @@ -186,16 +192,24 @@ Item { } Layout.fillWidth: true - Layout.fillHeight: true + Layout.fillHeight: listView.contentHeight > availableHeight Milou.ResultsListView { id: listView queryString: queryField.text - highlight: null clip: true PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.NormalColorGroup - onActivated: queryField.text = ""; + highlight: activeFocus ? highlightComponent : null + Component{ + id: highlightComponent + + PlasmaExtras.Highlight {} + } + + onActivated: { + root.close(); + } onUpdateQueryString: { queryField.text = text queryField.cursorPosition = cursorPosition @@ -214,6 +228,12 @@ Item { } hoverEnabled: true + function activateNextAction() { + queryField.forceActiveFocus(); + queryField.selectAll(); + listView.currentIndex = -1; + } + Rectangle { anchors.fill: parent color: delegate.pressed ? Qt.rgba(255, 255, 255, 0.2) : (delegate.containsMouse ? Qt.rgba(255, 255, 255, 0.05) : "transparent")