From 3df180dffc0450262521e842cbe09b3a1b7e9dd3 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 5 Jan 2022 14:13:11 +0100 Subject: QML: Improve library focus handling --- res/qml/Library.qml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/res/qml/Library.qml b/res/qml/Library.qml index d6589927ef..109ae529f7 100644 --- a/res/qml/Library.qml +++ b/res/qml/Library.qml @@ -15,6 +15,13 @@ Item { onMoveSelection: listView.moveSelection(offset) onLoadSelectedTrack: listView.loadSelectedTrack(group, play) onLoadSelectedTrackIntoNextAvailableDeck: listView.loadSelectedTrackIntoNextAvailableDeck(play) + onFocusWidgetChanged: { + switch (focusWidget) { + case FocusedWidgetControl.WidgetKind.LibraryView: + listView.forceActiveFocus(); + break; + } + } } ListView { @@ -54,7 +61,6 @@ Item { anchors.fill: parent anchors.margins: 10 clip: true - focus: true highlightMoveDuration: 250 highlightResizeDuration: 50 model: Mixxx.Library.model @@ -68,7 +74,7 @@ Item { Text { anchors.verticalCenter: parent.verticalCenter text: artist + " - " + title - color: listView.currentIndex == index ? Theme.blue : Theme.deckTextColor + color: (listView.currentIndex == index && listView.activeFocus) ? Theme.blue : Theme.deckTextColor Behavior on color { ColorAnimation { @@ -98,6 +104,7 @@ Item { anchors.fill: parent drag.target: dragItem onPressed: { + listView.forceActiveFocus(); listView.currentIndex = index; parent.grabToImage((result) => { dragItem.Drag.imageSource = result.url; @@ -108,7 +115,7 @@ Item { } highlight: Rectangle { - border.color: Theme.blue + border.color: listView.activeFocus ? Theme.blue : Theme.deckTextColor border.width: 1 color: "transparent" } -- cgit v1.2.3