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; */
|
||||
|
||||
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: DropArea {
|
||||
id: serviceDrop
|
||||
Component {
|
||||
id: delegate
|
||||
Kirigami.AbstractListItem {
|
||||
id: serviceListItem
|
||||
implicitWidth: serviceItemList.width
|
||||
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 */
|
||||
|
||||
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 {
|
||||
id: wheelHandler
|
||||
target: serviceItemList
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue