forked from qt-creator/qt-creator
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:
committed by
Henning Gründl
parent
0ac1920ed2
commit
ac0251e106
@@ -253,6 +253,10 @@ Rectangle {
|
|||||||
property bool tinyMode: Constants.thumbnailSize <= Constants.thumbnailBreak
|
property bool tinyMode: Constants.thumbnailSize <= Constants.thumbnailBreak
|
||||||
|
|
||||||
property int currentStateInternalId: 0
|
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
|
// 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
|
// 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
|
hasWhenCondition: delegateRoot.hasWhenCondition
|
||||||
|
|
||||||
scrollViewActive: horizontalBar.active || verticalBar.active
|
blockDragHandler: horizontalBar.active || verticalBar.active
|
||||||
|
|| root.menuOpen
|
||||||
|
|
||||||
dragParent: scrollView
|
dragParent: scrollView
|
||||||
|
|
||||||
|
onMenuOpenChanged: {
|
||||||
|
if (stateThumbnail.menuOpen)
|
||||||
|
root.menuOpen++
|
||||||
|
else
|
||||||
|
root.menuOpen--
|
||||||
|
}
|
||||||
|
|
||||||
// Fix ScrollView taking over the dragging event
|
// Fix ScrollView taking over the dragging event
|
||||||
onGrabbing: {
|
onGrabbing: {
|
||||||
frame.interactive = false
|
frame.interactive = false
|
||||||
|
@@ -55,7 +55,8 @@ Item {
|
|||||||
|
|
||||||
property bool hasWhenCondition: false
|
property bool hasWhenCondition: false
|
||||||
|
|
||||||
property bool scrollViewActive: false
|
property bool menuOpen: stateMenu.opened
|
||||||
|
property bool blockDragHandler: false
|
||||||
|
|
||||||
property Item dragParent
|
property Item dragParent
|
||||||
|
|
||||||
@@ -91,7 +92,7 @@ Item {
|
|||||||
|
|
||||||
DragHandler {
|
DragHandler {
|
||||||
id: dragHandler
|
id: dragHandler
|
||||||
enabled: !root.baseState && !root.extendedState && !root.scrollViewActive
|
enabled: !root.baseState && !root.extendedState && !root.blockDragHandler
|
||||||
onGrabChanged: function (transition, point) {
|
onGrabChanged: function (transition, point) {
|
||||||
if (transition === PointerDevice.GrabPassive
|
if (transition === PointerDevice.GrabPassive
|
||||||
|| transition === PointerDevice.GrabExclusive)
|
|| transition === PointerDevice.GrabExclusive)
|
||||||
|
Reference in New Issue
Block a user