diff --git a/assets/qml/PlatformDependent/Menubar.qml b/assets/qml/PlatformDependent/Menubar.qml index 847234d7..eea63173 100644 --- a/assets/qml/PlatformDependent/Menubar.qml +++ b/assets/qml/PlatformDependent/Menubar.qml @@ -25,6 +25,7 @@ import QtQuick.Controls 2.12 MenuBar { id: root + visible: app.menubarEnabled // // Set background color + border @@ -207,7 +208,7 @@ MenuBar { DecentMenuItem { sequence: "alt+m" - onTriggered: root.visible = !root.visible + onTriggered: app.toggleMenubar() text: root.visible ? qsTr("Hide menubar") : qsTr("Show menubar") } } diff --git a/assets/qml/Windows/Console.qml b/assets/qml/Windows/Console.qml index 192b07ac..30bda4bc 100644 --- a/assets/qml/Windows/Console.qml +++ b/assets/qml/Windows/Console.qml @@ -143,11 +143,17 @@ Control { enabled: Cpp_IO_Console.saveAvailable } - MenuSeparator {} + MenuSeparator { + visible: app.menuBar !== null + } MenuItem { - //onTriggered: app.menuBar.visible = !app.menuBar.visible - //text: app.menuBar.visible ? qsTr("Hide menubar") : qsTr("Show menubar") + enabled: visible + visible: app.menuBar !== null + onTriggered: app.toggleMenubar() + height: visible ? implicitHeight : 0 + text: visible && app.menuBar.visible ? qsTr("Hide menubar") : + qsTr("Show menubar") } } diff --git a/assets/qml/main.qml b/assets/qml/main.qml index 3ea65aab..d2d6e8c0 100644 --- a/assets/qml/main.qml +++ b/assets/qml/main.qml @@ -93,6 +93,11 @@ ApplicationWindow { readonly property bool dashboardAvailable: Cpp_UI_Provider.groupCount > 0 readonly property bool widgetsAvailable: Cpp_UI_WidgetProvider.totalWidgetCount > 0 + // + // Menubar status + // + property bool menubarEnabled: true + // // Check for updates (non-silent mode) // @@ -150,6 +155,13 @@ ApplicationWindow { terminal.copy() } + // + // Hide/show menubar + // + function toggleMenubar() { + app.menubarEnabled = !app.menubarEnabled + } + // // Select all console text // @@ -303,6 +315,7 @@ ApplicationWindow { property alias appStatus: app.appLaunchStatus property alias autoUpdater: app.automaticUpdates property alias appMaximized: app.windowMaximized + property alias menubarVisible: app.menubarEnabled } //