From 488c30039ef8bdbac1c14c015a692b21551d3328 Mon Sep 17 00:00:00 2001 From: Bryant Date: Mon, 28 Jul 2014 19:46:36 -0700 Subject: [PATCH 1/4] Adjust stylesheets to render menubar items correctly. There is a *bug in Qt5 (as of 5.3.1) where QMenuBar::items don't inherit their background colors, but revert to default system styling. The work around is to explicitly color their backgrounds. --- files/styles/style-dark.css | 8 ++++++++ files/styles/style-light.css | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/files/styles/style-dark.css b/files/styles/style-dark.css index 5f6c8da..9716a85 100644 --- a/files/styles/style-dark.css +++ b/files/styles/style-dark.css @@ -334,6 +334,14 @@ QMenu::separator { margin: 8px 5px 4px 5px; } +/* + * Fix for bug in Qt5 where QMenuBar items are styled natively on Windows, ignoring inherited settings. + * so we explicitly set their background color here (should match catch-all style background color). + */ +QMenuBar::item { + background-color: #222; +} + QMenuBar::item:selected { background-color: #CCC; color: #000; diff --git a/files/styles/style-light.css b/files/styles/style-light.css index 25c38ad..74ab01c 100644 --- a/files/styles/style-light.css +++ b/files/styles/style-light.css @@ -278,6 +278,14 @@ QMenu::separator { margin: 8px 5px 4px 5px; } +/* + * Fix for bug in Qt5 where QMenuBar items are styled natively on Windows, ignoring inherited settings. + * so we explicitly set their background color here (should match catch-all style background color). + */ +QMenuBar::item { + background-color: #F6F6F6; +} + QMenuBar::item:selected { background-color: #555; color: #FFF; From 789a5fa7d7cb2b8ae0e3a8855ea4ca2332715060 Mon Sep 17 00:00:00 2001 From: Bryant Date: Mon, 28 Jul 2014 19:47:07 -0700 Subject: [PATCH 2/4] Add action item to MainWindow.cc --- src/ui/MainWindow.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index cc78d0f..5b5bbf3 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -191,6 +191,7 @@ void MainWindow::init() menuActionHelper->setMenu(ui.menuTools); // Qt 4 on Ubuntu does place the native menubar correctly so on Linux we revert back to in-window menu bar. + // TODO: Check that this is still necessary on Qt5 on Ubuntu #ifdef Q_OS_LINUX menuBar()->setNativeMenuBar(false); #endif From 021f1e9c58f95617d333b92cc25269dcc0fee4c5 Mon Sep 17 00:00:00 2001 From: Bryant Date: Mon, 28 Jul 2014 19:47:20 -0700 Subject: [PATCH 3/4] Remove old dead code from MainWindow.cc --- src/ui/MainWindow.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 5b5bbf3..9598756 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -196,9 +196,6 @@ void MainWindow::init() menuBar()->setNativeMenuBar(false); #endif - // We only need this menu if we have more than one system - // ui.menuConnected_Systems->setEnabled(false); - // Set dock options setDockOptions(AnimatedDocks | AllowTabbedDocks | AllowNestedDocks); From 07a50dbb4ea23dcff8ce0d460615552c29026f53 Mon Sep 17 00:00:00 2001 From: Bryant Date: Mon, 28 Jul 2014 20:24:28 -0700 Subject: [PATCH 4/4] Fixed missing argument in debug messages. Now they're readable! --- src/main.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cc b/src/main.cc index ab7d0c9..b945d85 100644 --- a/src/main.cc +++ b/src/main.cc @@ -55,7 +55,7 @@ This file is part of the QGROUNDCONTROL project void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { const char symbols[] = { 'I', 'E', '!', 'X' }; - QString output = QString("[%1] in %2:%3 - \"%2\"").arg(symbols[type]).arg(context.file).arg(context.line).arg(msg); + QString output = QString("[%1] at %2:%3 - \"%4\"").arg(symbols[type]).arg(context.file).arg(context.line).arg(msg); std::cerr << output.toStdString() << std::endl; if( type == QtFatalMsg ) abort(); }