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>
This commit is contained in:
Henning Gruendl
2022-10-06 11:15:22 +02:00
committed by Henning Gründl
parent 0ac1920ed2
commit ac0251e106
2 changed files with 16 additions and 3 deletions

View File

@@ -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

View File

@@ -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)