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")
(compilation-read-command . (nil))
(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))))))
(projectile-project-compilation-cmd . "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -B buld/ . && make --dir build/"))))

View file

@ -17,6 +17,7 @@ Item {
* The id of the ListView the delegates belong to.
*/
property ListView listView
property bool containsMouse
/**
* Emitted when the drag handle wants to move the item in the model
@ -36,7 +37,7 @@ Item {
signal dropped()
// Emitted when clicking to activate underneath mousearea
signal activated()
signal clicked()
MouseArea {
id: mouseArea
@ -126,7 +127,10 @@ Item {
MouseArea {
id: clickArea
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 {
id: itemDelegate
Item {
implicitWidth: ListView.view.width
id: serviceItem
implicitWidth: serviceItemList.width
height: 50
Kirigami.BasicListItem {
id: serviceItem
width: serviceItemList.width
height: 50
anchors.fill: parent
label: name
subtitle: type
hoverEnabled: true
supportsMouseEvents: false
backgroundColor: {
if (serviceDrop.containsDrag | isCurrentItem) {
Kirigami.Theme.highlightColor
} else
Kirigami.Theme.viewBackgroundColor
if (parent.ListView.isCurrentItem) {
Kirigami.Theme.highlightColor;
/* } else if (serviceDrop.constainsDrag){ */
/* 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 {
width: serviceItemList.width
height: 50
/* anchors.fill: parent */
id: mouseHandler
anchors.fill: parent
listItem: serviceItem
listView: serviceItemList
onMoveRequested: serviceListModel.move(oldIndex, newIndex, 1)
onActivated: serviceItemList.currentIndex = index && showPassiveNotification(serviceItemList.currentIndex)
onClicked: {
serviceItemList.currentIndex = index;
showPassiveNotification(serviceItemList.currentIndex);
}
}
DropArea {
id: serviceDrop
width: serviceItemList.width
height: 50
anchors.fill: parent
onDropped: {
serviceListModel.insert(index, {"name": dragSongTitle, "type": "song"});
showPassiveNotification(index);
@ -121,9 +131,10 @@ ColumnLayout {
Controls.ScrollBar.vertical: Controls.ScrollBar {
anchors.right: serviceItemList.right
anchors.leftMargin: 10
anchors.rightMargin: 0
active: hovered || pressed
}
ListModel {
id: serviceListModel
ListElement {
@ -142,6 +153,22 @@ ColumnLayout {
name: "Marvelous Light"
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 {
height: selectedLibrary == "songs" ? 40 : 0
width: parent.width
display: IconOnly
display: Button.IconOnly
actions: [
Kirigami.Action {
icon.name: "document-new"
@ -148,7 +148,7 @@ Item {
property bool rightMenu: false
implicitWidth: ListView.view.width
implicitWidth: songLibraryList.width
height: selectedLibrary == "songs" ? 50 : 0
clip: true
label: title
@ -158,7 +158,7 @@ Item {
if (parent.ListView.isCurrentItem) {
Kirigami.Theme.highlightColor;
} else if (dragHandler.containsMouse){
Kirigami.Theme.hoverColor;
Kirigami.Theme.highlightColor;
} else {
Kirigami.Theme.backgroundColor;
}