serviceListItem in an easier to drag container
This commit is contained in:
parent
2b84e05a0b
commit
72a0c8c4c8
1 changed files with 199 additions and 183 deletions
|
@ -85,44 +85,21 @@ Item {
|
||||||
|
|
||||||
/* onExited: dropHighlightLine.visible = false; */
|
/* onExited: dropHighlightLine.visible = false; */
|
||||||
|
|
||||||
ListView {
|
Component {
|
||||||
id: serviceItemList
|
id: delegate
|
||||||
anchors.top: parent.top
|
Kirigami.AbstractListItem {
|
||||||
anchors.bottom: parent.bottom
|
id: serviceListItem
|
||||||
anchors.left: parent.left
|
|
||||||
width: serviceListScrollBar.visible ?
|
|
||||||
parent.width - serviceListScrollBar.width : parent.width
|
|
||||||
clip: true
|
|
||||||
spacing: 3
|
|
||||||
property int indexDragged
|
|
||||||
property int moveToIndex
|
|
||||||
property int draggedY
|
|
||||||
|
|
||||||
addDisplaced: Transition {
|
|
||||||
NumberAnimation {properties: "x, y"; duration: 100}
|
|
||||||
}
|
|
||||||
moveDisplaced: Transition {
|
|
||||||
NumberAnimation { properties: "x, y"; duration: 100 }
|
|
||||||
}
|
|
||||||
remove: Transition {
|
|
||||||
NumberAnimation { properties: "x, y"; duration: 100 }
|
|
||||||
NumberAnimation { properties: "opacity"; duration: 100 }
|
|
||||||
}
|
|
||||||
|
|
||||||
removeDisplaced: Transition {
|
|
||||||
NumberAnimation { properties: "x, y"; duration: 100 }
|
|
||||||
}
|
|
||||||
|
|
||||||
displaced: Transition {
|
|
||||||
NumberAnimation {properties: "x, y"; duration: 100}
|
|
||||||
}
|
|
||||||
|
|
||||||
model: serviceItemModel
|
|
||||||
|
|
||||||
delegate: DropArea {
|
|
||||||
id: serviceDrop
|
|
||||||
implicitWidth: serviceItemList.width
|
implicitWidth: serviceItemList.width
|
||||||
height: 30
|
height: 30
|
||||||
|
Kirigami.ListItemDragHandle {
|
||||||
|
anchors.fill: parent
|
||||||
|
listItem: serviceListItem
|
||||||
|
listView: serviceItemList
|
||||||
|
onMoveRequested: serviceItemModel.move(oldIndex, newIndex, 1)
|
||||||
|
}
|
||||||
|
DropArea {
|
||||||
|
id: serviceDrop
|
||||||
|
anchors.fill: parent
|
||||||
/* enabled: false */
|
/* enabled: false */
|
||||||
|
|
||||||
onEntered: (drag) => {
|
onEntered: (drag) => {
|
||||||
|
@ -301,8 +278,47 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: serviceItemList
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
width: serviceListScrollBar.visible ?
|
||||||
|
parent.width - serviceListScrollBar.width : parent.width
|
||||||
|
clip: true
|
||||||
|
spacing: 3
|
||||||
|
property int indexDragged
|
||||||
|
property int moveToIndex
|
||||||
|
property int draggedY
|
||||||
|
|
||||||
|
addDisplaced: Transition {
|
||||||
|
NumberAnimation {properties: "x, y"; duration: 100}
|
||||||
|
}
|
||||||
|
moveDisplaced: Transition {
|
||||||
|
NumberAnimation { properties: "x, y"; duration: 100 }
|
||||||
|
}
|
||||||
|
remove: Transition {
|
||||||
|
NumberAnimation { properties: "x, y"; duration: 100 }
|
||||||
|
NumberAnimation { properties: "opacity"; duration: 100 }
|
||||||
|
}
|
||||||
|
|
||||||
|
removeDisplaced: Transition {
|
||||||
|
NumberAnimation { properties: "x, y"; duration: 100 }
|
||||||
|
}
|
||||||
|
|
||||||
|
displaced: Transition {
|
||||||
|
NumberAnimation {properties: "x, y"; duration: 100}
|
||||||
|
}
|
||||||
|
|
||||||
|
model: serviceItemModel
|
||||||
|
|
||||||
|
delegate: Kirigami.DelegateRecycler {
|
||||||
|
width: serviceItemList.width
|
||||||
|
sourceComponent: delegate
|
||||||
|
}
|
||||||
Kirigami.WheelHandler {
|
Kirigami.WheelHandler {
|
||||||
id: wheelHandler
|
id: wheelHandler
|
||||||
target: serviceItemList
|
target: serviceItemList
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue