[vlc-devel] [PATCH 12/18] qml: revise menu handling in Player
Prince Gupta
guptaprince8832 at gmail.com
Thu Apr 1 14:29:47 UTC 2021
1. make _menu member public, it's already being used outside the class
2. support Popup like objects as a menu
---
modules/gui/qt/player/qml/ControlButtons.qml | 4 ++--
modules/gui/qt/player/qml/Player.qml | 10 +++++++---
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index e04c00d45c..27b4d561d8 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -448,13 +448,13 @@ Item{
onOpened: {
controlButtons.requestLockUnlockAutoHide(true, controlButtons)
- rootPlayer._menu = langMenu
+ rootPlayer.menu = langMenu
}
onMenuClosed: {
controlButtons.requestLockUnlockAutoHide(false, controlButtons)
langBtn.forceActiveFocus()
- rootPlayer._menu = undefined
+ rootPlayer.menu = undefined
}
}
}
diff --git a/modules/gui/qt/player/qml/Player.qml b/modules/gui/qt/player/qml/Player.qml
index e7190fcd34..a8833ef3b0 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -32,7 +32,7 @@ Widgets.NavigableFocusScope {
id: rootPlayer
//menu/overlay to dismiss
- property var _menu: undefined
+ property var menu: undefined
property int _lockAutoHide: 0
readonly property bool _autoHide: _lockAutoHide == 0
&& rootPlayer.hasEmbededVideo
@@ -92,8 +92,12 @@ Widgets.NavigableFocusScope {
}
function dismiss() {
- if (_menu)
- _menu.dismiss()
+ if ((typeof menu === undefined) || !menu)
+ return
+ if (menu.hasOwnProperty("dismiss"))
+ menu.dismiss()
+ else if (menu.hasOwnProperty("close"))
+ menu.close()
}
function lockUnlockAutoHide(lock, source /*unused*/) {
--
2.27.0
More information about the vlc-devel
mailing list