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,11 +236,26 @@ ItemDelegate {
*/ */
readonly property bool dragActive: dragHandler.drag.active readonly property bool dragActive: dragHandler.drag.active
onDragActiveChanged: { onDragActiveChanged: {
if (dragActive) if (dragActive) {
Drag.start() Drag.start()
else root.dragStarted()
Drag.drop() 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: [ states: [
State { State {

View File

@ -74,14 +74,6 @@ ColumnLayout {
drag.accept() 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 { StatusDraggableListItem {
id: draggableDelegate id: draggableDelegate
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@ -102,6 +94,14 @@ ColumnLayout {
icon.height: 40 icon.height: 40
icon.name: model.emoji icon.name: model.emoji
icon.color: Utils.getColorForId(model.colorId) 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)
}
} }
} }
} }