[vlc-commits] qml: pass mouse position to contextMenuButtonClicked signal
Pierre Lamot
git at videolan.org
Mon Sep 28 09:38:06 CEST 2020
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Fri Sep 18 15:03:16 2020 +0200| [c04fa9463c0999b6792d394c3e78d0f03f5b8a1a] | committer: Pierre Lamot
qml: pass mouse position to contextMenuButtonClicked signal
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c04fa9463c0999b6792d394c3e78d0f03f5b8a1a
---
modules/gui/qt/widgets/qml/GridItem.qml | 8 ++++----
modules/gui/qt/widgets/qml/KeyNavigableTableView.qml | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/modules/gui/qt/widgets/qml/GridItem.qml b/modules/gui/qt/widgets/qml/GridItem.qml
index b0495fdca0..792d7cb757 100644
--- a/modules/gui/qt/widgets/qml/GridItem.qml
+++ b/modules/gui/qt/widgets/qml/GridItem.qml
@@ -49,9 +49,9 @@ FocusScope {
signal addToPlaylistClicked
signal itemClicked(Item menuParent, int key, int modifier)
signal itemDoubleClicked(Item menuParent, int keys, int modifier)
- signal contextMenuButtonClicked(Item menuParent)
+ signal contextMenuButtonClicked(Item menuParent, var globalMousePos)
- Keys.onMenuPressed: root.contextMenuButtonClicked(picture)
+ Keys.onMenuPressed: root.contextMenuButtonClicked(picture, root.mapToGlobal(0,0))
Accessible.role: Accessible.Cell
Accessible.name: title
@@ -114,11 +114,11 @@ FocusScope {
implicitHeight: content.implicitHeight
acceptedButtons: Qt.RightButton | Qt.LeftButton
- Keys.onMenuPressed: root.contextMenuButtonClicked(picture)
+ Keys.onMenuPressed: root.contextMenuButtonClicked(picture, root.mapToGlobal(0,0))
onClicked: {
if (mouse.button === Qt.RightButton)
- contextMenuButtonClicked(picture);
+ contextMenuButtonClicked(picture, mouseArea.mapToGlobal(mouse.x,mouse.y));
else {
root.itemClicked(picture, mouse.button, mouse.modifiers);
}
diff --git a/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml b/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
index 727266eb94..52c2547b19 100644
--- a/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
+++ b/modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
@@ -31,7 +31,7 @@ NavigableFocusScope {
//forwarded from subview
signal actionForSelection( var selection )
signal contextMenuButtonClicked(Item menuParent, var menuModel)
- signal rightClick(Item menuParent, var menuModel)
+ signal rightClick(Item menuParent, var menuModel, var globalMousePos)
signal itemDoubleClicked(var model)
property var sortModel: []
@@ -226,7 +226,7 @@ NavigableFocusScope {
lineView.forceActiveFocus()
if (mouse.button === Qt.RightButton){
- root.rightClick(lineView,rowModel)
+ root.rightClick(lineView,rowModel, hoverArea.mapToGlobal(mouse.x,mouse.y) )
}
}
More information about the vlc-commits
mailing list