Skip to content
Snippets Groups Projects
Commit 2d5967f5 authored by Fatih Uzunoğlu's avatar Fatih Uzunoğlu Committed by Steve Lhomme
Browse files

qml: hide toolbar editor delegate until drop is completed

Currently, when `drop()` is called, the delegate is shown
in its original position with internal drag. This causes
the delegate to be shown for a momentary period of time
until it is removed from the view.

In order to prevent flickering, hide the delegate before
calling `drop()` and if the delegate is dropped in the same
view (intra-view move) then show it since the delegate
should not remain hidden in its new position.
parent 20343e3b
No related branches found
No related tags found
1 merge request!6338qml: fix tool bar editor delegate flickering
Pipeline #536656 passed with stage
in 37 minutes and 22 seconds
......@@ -75,7 +75,10 @@ T.Control {
} else {
dragAutoScrollHandler.dragItem = null
drag.target.Drag.drop()
control.visible = false
const action = drag.target.Drag.drop()
if (action === Qt.IgnoreAction)
control.visible = true
removeInfoRectVisible = false
root.dragStopped(controlId)
}
......@@ -103,11 +106,11 @@ T.Control {
onDropped: (drop) => {
let destIndex = parent.DelegateModel.itemsIndex
if((drag.source.dndView === dndView)
&& (drag.source.DelegateModel.itemsIndex < destIndex))
if((drop.source.dndView === dndView)
&& (drop.source.DelegateModel.itemsIndex < destIndex))
--destIndex
dropEvent(drag, destIndex)
dropEvent(drop, destIndex)
}
}
......
......@@ -81,13 +81,17 @@ ListView {
// moving from same section
playerBtnDND.model.move(drag.source.DelegateModel.itemsIndex,
destIndex)
drag.source.visible = true
drag.accept(Qt.MoveAction)
} else if (drag.source.objectName === "buttonsList") {
// moving from buttonsList
playerBtnDND.model.insert(destIndex, {"id" : drag.source.mIndex})
drag.accept(Qt.CopyAction)
} else {
// moving between sections or views
playerBtnDND.model.insert(destIndex, {"id" : drag.source.controlId})
drag.source.dndView.model.remove(drag.source.DelegateModel.itemsIndex)
drag.accept(Qt.MoveAction)
}
}
......@@ -155,10 +159,10 @@ ListView {
onDropped: (drop) => {
let destIndex = playerBtnDND.count
if (drag.source.dndView === playerBtnDND)
if (drop.source.dndView === playerBtnDND)
--destIndex
dropEvent(drag, destIndex)
dropEvent(drop, destIndex)
}
}
}
......
......@@ -79,7 +79,8 @@ GridView {
if (isFromList())
return
drag.source.dndView.model.remove(drag.source.DelegateModel.itemsIndex)
drop.source.dndView.model.remove(drop.source.DelegateModel.itemsIndex)
drop.accept(Qt.MoveAction)
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment