diff options
author | Henning Gruendl <henning.gruendl@qt.io> | 2022-10-06 11:15:22 +0200 |
---|---|---|
committer | Henning Gründl <henning.gruendl@qt.io> | 2022-10-20 12:09:14 +0000 |
commit | ac0251e1067ec363033b44772cba77adaff724b7 (patch) | |
tree | ef79d6fd59824315a90c517e5767bce950aac4cd | |
parent | 0ac1920ed2e083191891756ba3ac3309500cd5e0 (diff) |
QmlDesigner: Block DragHandler when menu open
Task-number: QDS-7851
Change-Id: Ia48e326c1f33d7b405eb2f93936e3aa99f0a9e60
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r-- | share/qtcreator/qmldesigner/newstateseditor/Main.qml | 14 | ||||
-rw-r--r-- | share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml | 5 |
2 files changed, 16 insertions, 3 deletions
diff --git a/share/qtcreator/qmldesigner/newstateseditor/Main.qml b/share/qtcreator/qmldesigner/newstateseditor/Main.qml index 540f70b485..4431252ecc 100644 --- a/share/qtcreator/qmldesigner/newstateseditor/Main.qml +++ b/share/qtcreator/qmldesigner/newstateseditor/Main.qml @@ -253,6 +253,10 @@ Rectangle { property bool tinyMode: Constants.thumbnailSize <= Constants.thumbnailBreak property int currentStateInternalId: 0 + // Using an int instead of a bool, because when opening a menu on one state and without closing + // opening a menu on another state will first trigger the open of the new popup and afterwards + // the close of the old popup. Using an int keeps track of number of opened popups. + property int menuOpen: 0 // This timer is used to delay the current state animation as it didn't work due to the // repeaters item not being positioned in time resulting in 0 x and y position if the grids @@ -797,10 +801,18 @@ Rectangle { hasWhenCondition: delegateRoot.hasWhenCondition - scrollViewActive: horizontalBar.active || verticalBar.active + blockDragHandler: horizontalBar.active || verticalBar.active + || root.menuOpen dragParent: scrollView + onMenuOpenChanged: { + if (stateThumbnail.menuOpen) + root.menuOpen++ + else + root.menuOpen-- + } + // Fix ScrollView taking over the dragging event onGrabbing: { frame.interactive = false diff --git a/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml b/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml index ce95aa2198..e154bb4d39 100644 --- a/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml +++ b/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml @@ -55,7 +55,8 @@ Item { property bool hasWhenCondition: false - property bool scrollViewActive: false + property bool menuOpen: stateMenu.opened + property bool blockDragHandler: false property Item dragParent @@ -91,7 +92,7 @@ Item { DragHandler { id: dragHandler - enabled: !root.baseState && !root.extendedState && !root.scrollViewActive + enabled: !root.baseState && !root.extendedState && !root.blockDragHandler onGrabChanged: function (transition, point) { if (transition === PointerDevice.GrabPassive || transition === PointerDevice.GrabExclusive) |