Finally getting leftdock into shape

This commit is contained in:
Chris Cochrun 2022-03-01 15:29:26 -06:00
parent e1c7e319c7
commit e0d4360f6f
4 changed files with 55 additions and 26 deletions

View file

@ -3,6 +3,4 @@
((nil . ((projectile-project-run-cmd . "./build/bin/presenter") ((nil . ((projectile-project-run-cmd . "./build/bin/presenter")
(compilation-read-command . (nil)) (compilation-read-command . (nil))
(projectile-project-compilation-cmd . "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -B buld/ . && make --dir build/"))) (projectile-project-compilation-cmd . "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -B buld/ . && make --dir build/"))))
(qml-mode . ((completion-at-point-functions . (list
(cape-super-capf #'cape-dabbrev #'cape-dict))))))

View file

@ -17,6 +17,7 @@ Item {
* The id of the ListView the delegates belong to. * The id of the ListView the delegates belong to.
*/ */
property ListView listView property ListView listView
property bool containsMouse
/** /**
* Emitted when the drag handle wants to move the item in the model * Emitted when the drag handle wants to move the item in the model
@ -36,7 +37,7 @@ Item {
signal dropped() signal dropped()
// Emitted when clicking to activate underneath mousearea // Emitted when clicking to activate underneath mousearea
signal activated() signal clicked()
MouseArea { MouseArea {
id: mouseArea id: mouseArea
@ -126,7 +127,10 @@ Item {
MouseArea { MouseArea {
id: clickArea id: clickArea
anchors.fill: parent anchors.fill: parent
onClicked: root.activated() onClicked: root.clicked()
hoverEnabled: true
onEntered: root.containsMouse = true
onExited: root.containsMouse = false
} }
} }
} }

View file

@ -71,38 +71,48 @@ ColumnLayout {
Component { Component {
id: itemDelegate id: itemDelegate
Item { Item {
implicitWidth: ListView.view.width id: serviceItem
implicitWidth: serviceItemList.width
height: 50 height: 50
Kirigami.BasicListItem { Kirigami.BasicListItem {
id: serviceItem anchors.fill: parent
width: serviceItemList.width
height: 50
label: name label: name
subtitle: type subtitle: type
hoverEnabled: true hoverEnabled: true
supportsMouseEvents: false supportsMouseEvents: false
backgroundColor: { backgroundColor: {
if (serviceDrop.containsDrag | isCurrentItem) { if (parent.ListView.isCurrentItem) {
Kirigami.Theme.highlightColor Kirigami.Theme.highlightColor;
} else /* } else if (serviceDrop.constainsDrag){ */
Kirigami.Theme.viewBackgroundColor /* Kirigami.Theme.hoverColor; */
} else if (mouseHandler.containsMouse){
Kirigami.Theme.highlightColor;
} else {
Kirigami.Theme.backgroundColor;
}
}
textColor: {
if (parent.ListView.isCurrentItem || mouseHandler.containsMouse)
activeTextColor;
else
Kirigami.Theme.textColor;
} }
/* onClicked: serviceItemList.currentIndex = index && showPassiveNotification(serviceItemList.currentIndex) */
} }
Presenter.DragHandle { Presenter.DragHandle {
width: serviceItemList.width id: mouseHandler
height: 50 anchors.fill: parent
/* anchors.fill: parent */
listItem: serviceItem listItem: serviceItem
listView: serviceItemList listView: serviceItemList
onMoveRequested: serviceListModel.move(oldIndex, newIndex, 1) onMoveRequested: serviceListModel.move(oldIndex, newIndex, 1)
onActivated: serviceItemList.currentIndex = index && showPassiveNotification(serviceItemList.currentIndex) onClicked: {
serviceItemList.currentIndex = index;
showPassiveNotification(serviceItemList.currentIndex);
}
} }
DropArea { DropArea {
id: serviceDrop id: serviceDrop
width: serviceItemList.width anchors.fill: parent
height: 50
onDropped: { onDropped: {
serviceListModel.insert(index, {"name": dragSongTitle, "type": "song"}); serviceListModel.insert(index, {"name": dragSongTitle, "type": "song"});
showPassiveNotification(index); showPassiveNotification(index);
@ -121,9 +131,10 @@ ColumnLayout {
Controls.ScrollBar.vertical: Controls.ScrollBar { Controls.ScrollBar.vertical: Controls.ScrollBar {
anchors.right: serviceItemList.right anchors.right: serviceItemList.right
anchors.leftMargin: 10 anchors.rightMargin: 0
active: hovered || pressed active: hovered || pressed
} }
ListModel { ListModel {
id: serviceListModel id: serviceListModel
ListElement { ListElement {
@ -142,6 +153,22 @@ ColumnLayout {
name: "Marvelous Light" name: "Marvelous Light"
type: "song" type: "song"
} }
ListElement {
name: "10,000 Reason"
type: "song"
}
ListElement {
name: "Marvelous Light"
type: "song"
}
ListElement {
name: "10,000 Reason"
type: "song"
}
ListElement {
name: "Marvelous Light"
type: "song"
}
} }
} }

View file

@ -107,7 +107,7 @@ Item {
Kirigami.ActionToolBar { Kirigami.ActionToolBar {
height: selectedLibrary == "songs" ? 40 : 0 height: selectedLibrary == "songs" ? 40 : 0
width: parent.width width: parent.width
display: IconOnly display: Button.IconOnly
actions: [ actions: [
Kirigami.Action { Kirigami.Action {
icon.name: "document-new" icon.name: "document-new"
@ -148,7 +148,7 @@ Item {
property bool rightMenu: false property bool rightMenu: false
implicitWidth: ListView.view.width implicitWidth: songLibraryList.width
height: selectedLibrary == "songs" ? 50 : 0 height: selectedLibrary == "songs" ? 50 : 0
clip: true clip: true
label: title label: title
@ -158,8 +158,8 @@ Item {
if (parent.ListView.isCurrentItem) { if (parent.ListView.isCurrentItem) {
Kirigami.Theme.highlightColor; Kirigami.Theme.highlightColor;
} else if (dragHandler.containsMouse){ } else if (dragHandler.containsMouse){
Kirigami.Theme.hoverColor; Kirigami.Theme.highlightColor;
} else { } else {
Kirigami.Theme.backgroundColor; Kirigami.Theme.backgroundColor;
} }
} }