fix(wallet): changes in account order in settings are not applied in wallet

Fixed an issue with dropping a draggable item outside the bounds of the DropArea.

Fixes #13836
This commit is contained in:
Sale Djenic 2024-04-09 10:24:10 +02:00 committed by saledjenic
parent 473e2e273f
commit d4fa715c7e
2 changed files with 26 additions and 11 deletions

View File

@ -236,12 +236,27 @@ ItemDelegate {
*/
readonly property bool dragActive: dragHandler.drag.active
onDragActiveChanged: {
if (dragActive)
if (dragActive) {
Drag.start()
else
Drag.drop()
root.dragStarted()
return
}
Drag.drop()
root.dragFinished()
}
/*!
\qmlsignal
This signal is emitted when dragging the StatusDraggableListItem item started.
*/
signal dragStarted()
/*!
\qmlsignal
This signal is emitted when dragging the StatusDraggableListItem item finished.
*/
signal dragFinished()
states: [
State {
when: root.dragActive

View File

@ -74,14 +74,6 @@ ColumnLayout {
drag.accept()
}
onDropped: function(drop) {
let from = d.indexMoveFrom
let to = d.indexMoveTo
d.indexMoveFrom = -1
d.indexMoveTo = -1
root.walletStore.moveAccountFinally(from, to)
}
StatusDraggableListItem {
id: draggableDelegate
anchors.horizontalCenter: parent.horizontalCenter
@ -102,6 +94,14 @@ ColumnLayout {
icon.height: 40
icon.name: model.emoji
icon.color: Utils.getColorForId(model.colorId)
onDragFinished: {
let from = d.indexMoveFrom
let to = d.indexMoveTo
d.indexMoveFrom = -1
d.indexMoveTo = -1
root.walletStore.moveAccountFinally(from, to)
}
}
}
}