[vlc-devel] [PATCH 15/18] qml: remove unused properties from Langmenu
Prince Gupta
guptaprince8832 at gmail.com
Thu Apr 1 14:29:50 UTC 2021
also base LanguageMenu on PopUp component, LanguageMenu is more like a
Popup than a menu, also menus in qml are now native.
---
modules/gui/qt/player/qml/ControlButtons.qml | 8 +++--
modules/gui/qt/player/qml/LanguageMenu.qml | 33 ++++----------------
2 files changed, 11 insertions(+), 30 deletions(-)
diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index 8f8a273a19..1bba954b4a 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -451,13 +451,15 @@ Item{
onOpened: {
controlButtons.requestLockUnlockAutoHide(true, controlButtons)
- rootPlayer.menu = langMenu
+ if (!!rootPlayer)
+ rootPlayer.menu = langMenu
}
- onMenuClosed: {
+ onClosed: {
controlButtons.requestLockUnlockAutoHide(false, controlButtons)
langBtn.forceActiveFocus()
- rootPlayer.menu = undefined
+ if (!!rootPlayer)
+ rootPlayer.menu = undefined
}
}
}
diff --git a/modules/gui/qt/player/qml/LanguageMenu.qml b/modules/gui/qt/player/qml/LanguageMenu.qml
index 321419162f..930fbef8f5 100644
--- a/modules/gui/qt/player/qml/LanguageMenu.qml
+++ b/modules/gui/qt/player/qml/LanguageMenu.qml
@@ -29,34 +29,17 @@ import "qrc:///widgets/" as Widgets
import "qrc:///util/" as Util
import "qrc:///util/KeyHelper.js" as KeyHelper
-T.Menu {
+T.Popup {
id: control
- property var parentMenu: undefined
- property bool _emitMenuClose: true
- signal menuClosed
-
- modal: true
- cascade: false
- closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
height: VLCStyle.dp(296, VLCStyle.scale)
width: (!!rootPlayer) ? rootPlayer.width : 0
- onOpened: {
- control._emitMenuClose = true
-
- for (var i = 0; i < control.count; i++) {
- if (control.itemAt(i).enabled) {
- control.currentIndex = i
- break
- }
- }
- }
-
- onClosed: {
- if (control._emitMenuClose) {
- menuClosed()
- }
+ // Popup.CloseOnPressOutside doesn't work with non-model Popup on Qt < 5.15
+ closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
+ modal: true
+ T.Overlay.modal: Rectangle {
+ color: "transparent"
}
contentItem: StackView {
@@ -107,10 +90,6 @@ T.Menu {
opacity: .8
}
- T.Overlay.modal: Rectangle {
- color: "transparent"
- }
-
function _updateWidth(isFirstPage) {
if (isFirstPage)
control.width = Qt.binding(function () {
--
2.27.0
More information about the vlc-devel
mailing list