diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2018-12-04 14:10:40 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2018-12-04 12:30:27 +0000 |
commit | ab89371e97d1427c6b3c019befe75071a14cb69d (patch) | |
tree | 5c6cfb4be937214938b044e7a2bdcbba79d06c27 | |
parent | 87c5eb8bea032d49a732d0e4257baf817e459f33 (diff) |
Fix context menu position in slide view
Mouse position mapping was done against incorrect object in case of
clicking on master slide.
Task-number: QT3DS-2820
Change-Id: Ic962eef50d18b8a97372a0de5ea6f62ee929abfe
Reviewed-by: Jere Tuliniemi <jere.tuliniemi@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | src/Authoring/Studio/Palettes/Slide/SlideView.qml | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Authoring/Studio/Palettes/Slide/SlideView.qml b/src/Authoring/Studio/Palettes/Slide/SlideView.qml index 5661f162..c8f409d0 100644 --- a/src/Authoring/Studio/Palettes/Slide/SlideView.qml +++ b/src/Authoring/Studio/Palettes/Slide/SlideView.qml @@ -37,10 +37,9 @@ Rectangle { readonly property bool masterSlide: _parentView.showMasterSlide - function handleMouseClicks(mouse) { + function handleMouseClicks(mouse, mappedCoords) { if (mouse.button === Qt.RightButton) { - const coords = slideList.mapToItem(root, mouse.x, mouse.y); - _parentView.showContextMenu(coords.x, coords.y, -1); + _parentView.showContextMenu(mappedCoords.x, mappedCoords.y, -1); } else { root.focus = true; //Unselect All element when we click outside slider item in listView. @@ -75,7 +74,10 @@ Rectangle { propagateComposedEvents: true acceptedButtons: Qt.AllButtons - onClicked: root.handleMouseClicks(mouse) + onClicked: { + const coords = mapToItem(root, mouse.x, mouse.y); + root.handleMouseClicks(mouse, coords); + } Column { id: masterButtonColumn @@ -177,10 +179,12 @@ Rectangle { z: -1 // Only reached when clicking outside delegates acceptedButtons: Qt.AllButtons onClicked: { - if (slideList.indexAt(mouse.x, mouse.y) === -1) - root.handleMouseClicks(mouse); - else + if (slideList.indexAt(mouse.x, mouse.y) === -1) { + const coords = mapToItem(root, mouse.x, mouse.y); + root.handleMouseClicks(mouse, coords); + } else { mouse.accepted = false; + } } onPressed: { if (slideList.indexAt(mouse.x, mouse.y) !== -1) |