forked from qt-creator/qt-creator
QmlDesigner: Fix drop incorrect place
* Fix drop incorrect place * Improve overall drag smoothness Task-number: QDS-7733 Change-Id: I70e23df54c0e52b423c21b883924c5daee955d0a Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Henning Gründl
parent
9542e9bd1c
commit
e32f585fda
@@ -599,11 +599,6 @@ Rectangle {
|
||||
|
||||
property int grabIndex: -1
|
||||
|
||||
function executeDrop(from, to) {
|
||||
statesEditorModel.drop(from, to)
|
||||
statesRepeater.grabIndex = -1
|
||||
}
|
||||
|
||||
model: statesEditorModel
|
||||
|
||||
onItemAdded: root.responsiveResize(root.width, root.height)
|
||||
@@ -646,27 +641,27 @@ Rectangle {
|
||||
return
|
||||
}
|
||||
|
||||
statesEditorModel.move(
|
||||
(drag.source as StateThumbnail).visualIndex,
|
||||
stateThumbnail.visualIndex)
|
||||
statesEditorModel.move(dragSource.visualIndex,
|
||||
stateThumbnail.visualIndex)
|
||||
}
|
||||
|
||||
onDropped: function (drop) {
|
||||
let dragSource = (drop.source as StateThumbnail)
|
||||
let dropSource = (drop.source as StateThumbnail)
|
||||
|
||||
if (dragSource === undefined)
|
||||
if (dropSource === undefined)
|
||||
return
|
||||
|
||||
if (dragSource.extendString !== stateThumbnail.extendString
|
||||
if (dropSource.extendString !== stateThumbnail.extendString
|
||||
|| stateThumbnail.extendedState) {
|
||||
return
|
||||
}
|
||||
|
||||
if (statesRepeater.grabIndex === stateThumbnail.visualIndex)
|
||||
if (statesRepeater.grabIndex === dropSource.visualIndex)
|
||||
return
|
||||
|
||||
statesRepeater.executeDrop(statesRepeater.grabIndex,
|
||||
stateThumbnail.visualIndex)
|
||||
statesEditorModel.drop(statesRepeater.grabIndex,
|
||||
dropSource.visualIndex)
|
||||
statesRepeater.grabIndex = -1
|
||||
}
|
||||
|
||||
// Extend Groups Visualization
|
||||
@@ -768,6 +763,8 @@ Rectangle {
|
||||
|
||||
hasWhenCondition: delegateRoot.hasWhenCondition
|
||||
|
||||
dragParent: scrollView
|
||||
|
||||
// Fix ScrollView taking over the dragging event
|
||||
onGrabbing: {
|
||||
frame.interactive = false
|
||||
@@ -775,14 +772,6 @@ Rectangle {
|
||||
}
|
||||
onLetGo: frame.interactive = true
|
||||
|
||||
// Fix for ScrollView clipping while dragging of StateThumbnail
|
||||
onDragActiveChanged: {
|
||||
if (stateThumbnail.dragActive)
|
||||
parent = scrollViewWrapper
|
||||
else
|
||||
parent = delegateRoot
|
||||
}
|
||||
|
||||
stateName: delegateRoot.stateName
|
||||
thumbnailImageSource: delegateRoot.stateImageSource
|
||||
whenCondition: delegateRoot.whenConditionString
|
||||
|
@@ -55,6 +55,8 @@ Item {
|
||||
|
||||
property bool hasWhenCondition: false
|
||||
|
||||
property Item dragParent
|
||||
|
||||
property int visualIndex: 0
|
||||
|
||||
property int internalNodeId
|
||||
@@ -765,6 +767,11 @@ Item {
|
||||
name: "drag"
|
||||
when: dragHandler.active
|
||||
|
||||
ParentChange {
|
||||
target: root
|
||||
parent: root.dragParent
|
||||
}
|
||||
|
||||
AnchorChanges {
|
||||
target: root
|
||||
anchors.horizontalCenter: undefined
|
||||
|
Reference in New Issue
Block a user