summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Holthuis <jholthuis@mixxx.org>2021-12-13 14:16:19 +0100
committerJan Holthuis <jholthuis@mixxx.org>2022-01-11 19:53:42 +0100
commit339da28e882c0aa321befa1ce500a6046a711c91 (patch)
treed0e0477c9648cbd8d2e423f7dd046fe0a757759e
parent7819ed741373a5dfc1d8de371f24fda0783782cd (diff)
QML: Add support for track selection highlight to library
-rw-r--r--res/qml/Library.qml34
1 files changed, 28 insertions, 6 deletions
diff --git a/res/qml/Library.qml b/res/qml/Library.qml
index 1aca01955a..706d4e263e 100644
--- a/res/qml/Library.qml
+++ b/res/qml/Library.qml
@@ -9,21 +9,34 @@ Item {
anchors.fill: parent
ListView {
+ id: listView
+
anchors.fill: parent
anchors.margins: 10
clip: true
+ focus: true
+ highlightMoveDuration: 250
+ highlightResizeDuration: 50
model: Mixxx.Library.model
delegate: Item {
id: itemDelegate
- implicitWidth: 300
+ implicitWidth: listView.width
implicitHeight: 30
Text {
- anchors.fill: parent
+ anchors.verticalCenter: parent.verticalCenter
text: artist + " - " + title
- color: Theme.deckTextColor
+ color: listView.currentIndex == index ? Theme.blue : Theme.deckTextColor
+
+ Behavior on color {
+ ColorAnimation {
+ duration: listView.highlightMoveDuration
+ }
+
+ }
+
}
Image {
@@ -44,13 +57,22 @@ Item {
anchors.fill: parent
drag.target: dragItem
- onPressed: parent.grabToImage((result) => {
- dragItem.Drag.imageSource = result.url;
- })
+ onPressed: {
+ listView.currentIndex = index;
+ parent.grabToImage((result) => {
+ dragItem.Drag.imageSource = result.url;
+ });
+ }
}
}
+ highlight: Rectangle {
+ border.color: Theme.blue
+ border.width: 1
+ color: "transparent"
+ }
+
}
}