Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separator shouldn't display at bottom of "File" menu on Mac OS X #3345

Closed
follower opened this issue Feb 12, 2017 · 10 comments
Closed

Separator shouldn't display at bottom of "File" menu on Mac OS X #3345

follower opened this issue Feb 12, 2017 · 10 comments

Comments

@follower
Copy link
Contributor

follower commented Feb 12, 2017

This seems to be a regression related to the move from Qt4 to Qt5.

Notice there is a separator at the bottom of the "File" menu which is unnecessary and shouldn't be there:
lmms-menu-separator-issue-qt5

Version information (this is on Mac OS X 10.8.x):
lmms-menu-separator-issue-qt5-version-info

For comparison here is the same menu with Qt4:
lmms-menu-separator-issue-qt4

And version information for Qt4 build on same system:
lmms-menu-separator-issue-qt4-version-info

The reason this occurs is because Qt automatically moves the "Quit" menu item from the file menu to the "Apple Application Menu" as is usual for the platform. Normally any redundant separator is also removed at the same time.

This appears to be a known issue for Qt: "[QTBUG-40071] separatorsCollapsible does not work when menu items are moved to the application menu on Mac OS X".

I've added further detail to the QTBUG entry but have been unable to determine an underlying cause so far.

Before I realised it was an issue with Qt I developed a simple workaround which results in:

lmms-menu-separator-issue-qt5-workaround

Given that it appears to be a known issue that's not been resolved in nearly 3 years I'd suggest using the workaround in lmms in the meantime.

If desired I can make a PR with the workaround (with further documentation):

diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp
index 4a5bacb..aa943c8 100644
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -315,7 +315,9 @@ void MainWindow::finalize()
                                        SLOT( exportProjectMidi() ),
                                        Qt::CTRL + Qt::Key_M );*/
 
+#ifndef LMMS_BUILD_APPLE
        project_menu->addSeparator();
+#endif
        project_menu->addAction( embed::getIconPixmap( "exit" ), tr( "&Quit" ),
                                        qApp, SLOT( closeAllWindows() ),
                                        Qt::CTRL + Qt::Key_Q );

@tresf
Copy link
Member

tresf commented Feb 12, 2017

@follower please issue a pull request and we'd happily merge. Also; if Qt5 specific also add #if QT_VERSION >= 0x050000 ... Nevermind that last part, I realize this is a removal which should work fine on both Qt4/5

@follower
Copy link
Contributor Author

Thanks for taking a look.

I'm working on a PR and decided it was probably still wise to keep the version check as we know the workaround is not needed on 4 and my impression of Qt so far is that assumptions it won't break anything on Qt 4 may be misplaced. :)

Also, I've just realised that the "Help" menu also has the same issue, so will do the same there.

follower added a commit to follower/lmms that referenced this issue Feb 13, 2017
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:
 * <LMMS#3345>
 * <https://bugreports.qt.io/browse/QTBUG-40071>
follower added a commit to follower/lmms that referenced this issue Feb 13, 2017
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:
 * <LMMS#3345>
 * <https://bugreports.qt.io/browse/QTBUG-40071>
@follower
Copy link
Contributor Author

The original Qt bug has now been closed as "Cannot Reproduce" as of Qt 5.6, are you able to confirm this with one of your builds with a later Qt @tresf?

(Side note: As you might've guessed I finally managed to get Qt 5.5.1 + lmms building okay, so hopefully I can now contribute something more to lmms than requests for builds for obsolete OS. :D )

@tresf
Copy link
Member

tresf commented Feb 15, 2017

are you able to confirm [QTBUG-40071 is fixed] with one of your builds with a later Qt @tresf?

Yes, confirmed as fixed in Qt 5.7

image

@follower
Copy link
Contributor Author

follower commented Feb 15, 2017

Thanks for checking. :)

So that's fixed within Qt 5.7 and without needing a workaround in lmms?

If that's the case, would you like me to add an upper bound to the Qt version check for the workaround?

@tresf
Copy link
Member

tresf commented Feb 15, 2017

So that's fixed within Qt 5.7 and without needing a workaround in lmms?

Sounds like a noble idea. We're probably releasing 1.2 against Qt5.5 on Mac due to the macdeployqt bug that prevents us from packaging on newer versions (I'm currently working around this here but haven't merged the changes in yet.

@follower
Copy link
Contributor Author

I guess I'll take Qt's word for it and make the check be >= 5.0 and < 5.6. Feel free to verify 5.6. :)

@follower
Copy link
Contributor Author

Closed by merge of #3350.

@follower
Copy link
Contributor Author

FWIW recent tests & most recent comments on the original issue show that this issue still occurs in 5.6+.

This suggests the upper-bound version check should probably just be removed. (The linked comment also provides an alternate approach example of SLOT(onHelpAbout()) which might be worth considering.)

@tresf
Copy link
Member

tresf commented Sep 28, 2018

This suggests the upper-bound version check should probably just be removed.

Agreed. I see no harm in this. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants