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
|
property int grabIndex: -1
|
||||||
|
|
||||||
function executeDrop(from, to) {
|
|
||||||
statesEditorModel.drop(from, to)
|
|
||||||
statesRepeater.grabIndex = -1
|
|
||||||
}
|
|
||||||
|
|
||||||
model: statesEditorModel
|
model: statesEditorModel
|
||||||
|
|
||||||
onItemAdded: root.responsiveResize(root.width, root.height)
|
onItemAdded: root.responsiveResize(root.width, root.height)
|
||||||
@@ -646,27 +641,27 @@ Rectangle {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
statesEditorModel.move(
|
statesEditorModel.move(dragSource.visualIndex,
|
||||||
(drag.source as StateThumbnail).visualIndex,
|
stateThumbnail.visualIndex)
|
||||||
stateThumbnail.visualIndex)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onDropped: function (drop) {
|
onDropped: function (drop) {
|
||||||
let dragSource = (drop.source as StateThumbnail)
|
let dropSource = (drop.source as StateThumbnail)
|
||||||
|
|
||||||
if (dragSource === undefined)
|
if (dropSource === undefined)
|
||||||
return
|
return
|
||||||
|
|
||||||
if (dragSource.extendString !== stateThumbnail.extendString
|
if (dropSource.extendString !== stateThumbnail.extendString
|
||||||
|| stateThumbnail.extendedState) {
|
|| stateThumbnail.extendedState) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statesRepeater.grabIndex === stateThumbnail.visualIndex)
|
if (statesRepeater.grabIndex === dropSource.visualIndex)
|
||||||
return
|
return
|
||||||
|
|
||||||
statesRepeater.executeDrop(statesRepeater.grabIndex,
|
statesEditorModel.drop(statesRepeater.grabIndex,
|
||||||
stateThumbnail.visualIndex)
|
dropSource.visualIndex)
|
||||||
|
statesRepeater.grabIndex = -1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extend Groups Visualization
|
// Extend Groups Visualization
|
||||||
@@ -768,6 +763,8 @@ Rectangle {
|
|||||||
|
|
||||||
hasWhenCondition: delegateRoot.hasWhenCondition
|
hasWhenCondition: delegateRoot.hasWhenCondition
|
||||||
|
|
||||||
|
dragParent: scrollView
|
||||||
|
|
||||||
// Fix ScrollView taking over the dragging event
|
// Fix ScrollView taking over the dragging event
|
||||||
onGrabbing: {
|
onGrabbing: {
|
||||||
frame.interactive = false
|
frame.interactive = false
|
||||||
@@ -775,14 +772,6 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
onLetGo: frame.interactive = true
|
onLetGo: frame.interactive = true
|
||||||
|
|
||||||
// Fix for ScrollView clipping while dragging of StateThumbnail
|
|
||||||
onDragActiveChanged: {
|
|
||||||
if (stateThumbnail.dragActive)
|
|
||||||
parent = scrollViewWrapper
|
|
||||||
else
|
|
||||||
parent = delegateRoot
|
|
||||||
}
|
|
||||||
|
|
||||||
stateName: delegateRoot.stateName
|
stateName: delegateRoot.stateName
|
||||||
thumbnailImageSource: delegateRoot.stateImageSource
|
thumbnailImageSource: delegateRoot.stateImageSource
|
||||||
whenCondition: delegateRoot.whenConditionString
|
whenCondition: delegateRoot.whenConditionString
|
||||||
|
@@ -55,6 +55,8 @@ Item {
|
|||||||
|
|
||||||
property bool hasWhenCondition: false
|
property bool hasWhenCondition: false
|
||||||
|
|
||||||
|
property Item dragParent
|
||||||
|
|
||||||
property int visualIndex: 0
|
property int visualIndex: 0
|
||||||
|
|
||||||
property int internalNodeId
|
property int internalNodeId
|
||||||
@@ -765,6 +767,11 @@ Item {
|
|||||||
name: "drag"
|
name: "drag"
|
||||||
when: dragHandler.active
|
when: dragHandler.active
|
||||||
|
|
||||||
|
ParentChange {
|
||||||
|
target: root
|
||||||
|
parent: root.dragParent
|
||||||
|
}
|
||||||
|
|
||||||
AnchorChanges {
|
AnchorChanges {
|
||||||
target: root
|
target: root
|
||||||
anchors.horizontalCenter: undefined
|
anchors.horizontalCenter: undefined
|
||||||
|
Reference in New Issue
Block a user