From a366f73ac5f5e4f4464445fb314c74c32e6ae151 Mon Sep 17 00:00:00 2001 From: follower Date: Tue, 14 Feb 2017 05:36:24 +1300 Subject: [PATCH 1/4] Workaround Qt5 bug that fails to remove separator at end of menu. When the Quit menu item is relocated to Application Menu on Mac OS X / macOS the separator above it should be removed. While Qt4 removes the separator, Qt5 does not remove the separator. For details see: * * --- src/gui/MainWindow.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index fc7ebe583dc..a5b23b72caa 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -315,7 +315,16 @@ void MainWindow::finalize() SLOT( exportProjectMidi() ), Qt::CTRL + Qt::Key_M );*/ +// +// Conditional compilation to workaround Qt5 bug that fails to remove +// separator at end of menu when the Quit menu item is relocated to +// Application Menu on Mac OS X / macOS. For details see: +// * +// * +// +#if !(defined(LMMS_BUILD_APPLE) && (QT_VERSION >= 0x050000)) project_menu->addSeparator(); +#endif project_menu->addAction( embed::getIconPixmap( "exit" ), tr( "&Quit" ), qApp, SLOT( closeAllWindows() ), Qt::CTRL + Qt::Key_Q ); From 8b9c11004c0939ee77bc7245d821426d4e707966 Mon Sep 17 00:00:00 2001 From: follower Date: Tue, 14 Feb 2017 05:46:34 +1300 Subject: [PATCH 2/4] Workaround Qt5 bug that fails to remove separator at end of Help menu. When the About menu item is relocated to Application Menu on Mac OS X / macOS the separator above it should be removed. While Qt4 removes the separator, Qt5 does not remove the separator. For details see: * * --- src/gui/MainWindow.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index a5b23b72caa..443cd9bbab5 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -399,7 +399,16 @@ void MainWindow::finalize() tr( "What's This?" ), this, SLOT( enterWhatsThisMode() ) ); +// +// Conditional compilation to workaround Qt5 bug that fails to remove +// separator at end of menu when the About menu item is relocated to +// Application Menu on Mac OS X / macOS. For details see: +// * +// * +// +#if !(defined(LMMS_BUILD_APPLE) && (QT_VERSION >= 0x050000)) help_menu->addSeparator(); +#endif help_menu->addAction( embed::getIconPixmap( "icon" ), tr( "About" ), this, SLOT( aboutLMMS() ) ); From eef0662a32b88dd5ba4c69e6ae51164cf7329594 Mon Sep 17 00:00:00 2001 From: follower Date: Thu, 16 Feb 2017 03:45:31 +1300 Subject: [PATCH 3/4] "Omit needless words." -- William Strunk && tresf :) --- src/gui/MainWindow.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 443cd9bbab5..c9f40f515d6 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -315,13 +315,7 @@ void MainWindow::finalize() SLOT( exportProjectMidi() ), Qt::CTRL + Qt::Key_M );*/ -// -// Conditional compilation to workaround Qt5 bug that fails to remove -// separator at end of menu when the Quit menu item is relocated to -// Application Menu on Mac OS X / macOS. For details see: -// * -// * -// +// Prevent dangling separator at end of menu per https://bugreports.qt.io/browse/QTBUG-40071 #if !(defined(LMMS_BUILD_APPLE) && (QT_VERSION >= 0x050000)) project_menu->addSeparator(); #endif @@ -399,13 +393,7 @@ void MainWindow::finalize() tr( "What's This?" ), this, SLOT( enterWhatsThisMode() ) ); -// -// Conditional compilation to workaround Qt5 bug that fails to remove -// separator at end of menu when the About menu item is relocated to -// Application Menu on Mac OS X / macOS. For details see: -// * -// * -// +// Prevent dangling separator at end of menu per https://bugreports.qt.io/browse/QTBUG-40071 #if !(defined(LMMS_BUILD_APPLE) && (QT_VERSION >= 0x050000)) help_menu->addSeparator(); #endif From 15265866441215f490c896999d041aaac2f15d68 Mon Sep 17 00:00:00 2001 From: follower Date: Fri, 17 Feb 2017 07:19:23 +1300 Subject: [PATCH 4/4] According to Qt, separator issue was fixed in 5.6+, so exclude them. @tresf confirmed fixed in 5.7. See: https://bugreports.qt.io/browse/QTBUG-40071 --- src/gui/MainWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index c9f40f515d6..9e1dcb407a9 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -316,7 +316,7 @@ void MainWindow::finalize() Qt::CTRL + Qt::Key_M );*/ // Prevent dangling separator at end of menu per https://bugreports.qt.io/browse/QTBUG-40071 -#if !(defined(LMMS_BUILD_APPLE) && (QT_VERSION >= 0x050000)) +#if !(defined(LMMS_BUILD_APPLE) && (QT_VERSION >= 0x050000) && (QT_VERSION < 0x050600)) project_menu->addSeparator(); #endif project_menu->addAction( embed::getIconPixmap( "exit" ), tr( "&Quit" ), @@ -394,7 +394,7 @@ void MainWindow::finalize() this, SLOT( enterWhatsThisMode() ) ); // Prevent dangling separator at end of menu per https://bugreports.qt.io/browse/QTBUG-40071 -#if !(defined(LMMS_BUILD_APPLE) && (QT_VERSION >= 0x050000)) +#if !(defined(LMMS_BUILD_APPLE) && (QT_VERSION >= 0x050000) && (QT_VERSION < 0x050600)) help_menu->addSeparator(); #endif help_menu->addAction( embed::getIconPixmap( "icon" ), tr( "About" ),