milou: make possible to use keyboard and fix scrolling

This commit is contained in:
Yari Polla 2023-03-20 15:05:13 +01:00
parent 2da1bb150f
commit afd8f59b89

View file

@ -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")