[vlc-devel] [PATCH 06/10] qml: fix Escape key event being handled twice in player menu
Pierre Lamot
pierre at videolabs.io
Mon Nov 18 18:14:09 CET 2019
popup item was grabbin Escape key before the application (as a shortcut)
then the Escape key was interpreted by the player itself
---
modules/gui/qt/qml/player/PlayerMenu.qml | 3 +++
modules/gui/qt/qml/player/PlayerMenuItem.qml | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/modules/gui/qt/qml/player/PlayerMenu.qml b/modules/gui/qt/qml/player/PlayerMenu.qml
index 66fb88d6f2..8dc1c680d4 100644
--- a/modules/gui/qt/qml/player/PlayerMenu.qml
+++ b/modules/gui/qt/qml/player/PlayerMenu.qml
@@ -39,6 +39,9 @@ T.Menu {
modal: true
cascade: false
+ //don't CloseOnEscape, otherwise the event is processed before our key handlers
+ closePolicy: Popup.CloseOnPressOutside
+
x:0
y:0
width: parent.width / 4
diff --git a/modules/gui/qt/qml/player/PlayerMenuItem.qml b/modules/gui/qt/qml/player/PlayerMenuItem.qml
index 4f6b6a0cac..96c0ceed18 100644
--- a/modules/gui/qt/qml/player/PlayerMenuItem.qml
+++ b/modules/gui/qt/qml/player/PlayerMenuItem.qml
@@ -124,6 +124,13 @@ T.MenuItem {
event.accepted = false
}
+ Keys.onReleased: {
+ if (KeyHelper.matchCancel(event)) {
+ event.accepted = true
+ parentMenu.dismiss()
+ }
+ }
+
onTriggered: {
if (parentMenu && subMenu) {
parentMenu._emitMenuClose = false
--
2.17.1
More information about the vlc-devel
mailing list