changeset 27468:8ba19629d5ef

compacter menu bars in dock widgets (bug #53902) * gui-preferences.h: style for compacter menu bars * octave-dock-widget.cc (handle_settings): set style for menu bar if widget has one
author Torsten Lilge <ttl-octave@mailbox.org>
date Thu, 03 Oct 2019 19:19:57 +0200
parents c7a898396151
children 7daf71f990f8
files libgui/src/gui-preferences.h libgui/src/octave-dock-widget.cc
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/gui-preferences.h	Thu Oct 03 18:09:14 2019 +0200
+++ b/libgui/src/gui-preferences.h	Thu Oct 03 19:19:57 2019 +0200
@@ -55,6 +55,8 @@
 const QString octgui_toolbar_style ("margin-top: 1px; margin-bottom: 1px;"
                                     "margin-left: 3px; margin-right: 3px;"
                                     "border: 0px;");
+const QString octgui_menubar_style ("margin-top: 0px; margin-bottom: 0px;"
+                                    "margin-left: 0px; margin-right: opx;");
 const QString octgui_filterbar_style ("margin-top: 1px; margin-bottom: 1px;"
                                       "margin-left: 3px; margin-right: 3px;");
 
--- a/libgui/src/octave-dock-widget.cc	Thu Oct 03 18:09:14 2019 +0200
+++ b/libgui/src/octave-dock-widget.cc	Thu Oct 03 19:19:57 2019 +0200
@@ -33,6 +33,7 @@
 #include <QSettings>
 #include <QStyle>
 #include <QToolBar>
+#include <QMenuBar>
 
 #include "octave-dock-widget.h"
 #include "resource-manager.h"
@@ -485,6 +486,9 @@
     QToolBar* toolbar = findChild <QToolBar *> ();
     if (toolbar)
       toolbar->setStyleSheet (toolbar->styleSheet () + octgui_toolbar_style);
+    QMenuBar* menubar = findChild <QMenuBar *> ();
+    if (menubar)
+      menubar->setStyleSheet (menubar->styleSheet () + octgui_menubar_style);
 
   }