summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Gruendl <henning.gruendl@qt.io>2022-09-23 23:53:27 +0200
committerHenning Gründl <henning.gruendl@qt.io>2022-09-26 08:27:31 +0000
commite32f585fdaa5c374fc5cd12e527876287c7ee6aa (patch)
treea0f709d4f176230eb779ac0084e95a04a808eebc
parent9542e9bd1c6cac1ddf1e6dad3f1c5a91e10d2341 (diff)
downloadqt-creator-e32f585fdaa5c374fc5cd12e527876287c7ee6aa.tar.gz
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>
-rw-r--r--share/qtcreator/qmldesigner/newstateseditor/Main.qml33
-rw-r--r--share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml7
2 files changed, 18 insertions, 22 deletions
diff --git a/share/qtcreator/qmldesigner/newstateseditor/Main.qml b/share/qtcreator/qmldesigner/newstateseditor/Main.qml
index dd9e5772b4..f38baa7bd4 100644
--- a/share/qtcreator/qmldesigner/newstateseditor/Main.qml
+++ b/share/qtcreator/qmldesigner/newstateseditor/Main.qml
@@ -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
diff --git a/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml b/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml
index 9cde5f2744..ee1ea8132a 100644
--- a/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml
+++ b/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml
@@ -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