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

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