Merge pull request #130 from phedlund/macOS_GUI_fixes

Fix for three GUI issues on macOS
This commit is contained in:
martinrotter 2017-07-11 07:09:08 +02:00 committed by GitHub
commit 7bf27d7c0a
4 changed files with 27 additions and 2 deletions

View File

@ -459,8 +459,10 @@ SOURCES += src/core/feeddownloader.cpp \
src/core/messagesmodelcache.cpp \
src/core/messagesmodelsqllayer.cpp \
src/gui/treeviewcolumnsmenu.cpp \
src/services/abstract/labelsrootitem.cpp \
src/services/abstract/label.cpp
src/services/abstract/labelsrootitem.cpp \
src/services/abstract/label.cpp
OBJECTIVE_SOURCES += src/miscellaneous/disablewindowtabbing.mm
FORMS += src/gui/toolbareditor.ui \
src/network-web/downloaditem.ui \
@ -763,6 +765,7 @@ mac {
ICON = resources/macosx/$${TARGET}.icns
QMAKE_MAC_SDK = macosx10.12
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
LIBS += -framework AppKit
target.path = $$quote($$PREFIX/Contents/MacOS/)

View File

@ -134,11 +134,15 @@ QList<QAction*> FormMain::allActions() const {
actions << m_ui->m_actionBackupDatabaseSettings;
actions << m_ui->m_actionRestart;
actions << m_ui->m_actionQuit;
#if !defined(Q_OS_MAC)
actions << m_ui->m_actionFullscreen;
#endif
actions << m_ui->m_actionAboutGuard;
actions << m_ui->m_actionSwitchFeedsList;
actions << m_ui->m_actionSwitchMainWindow;
#if !defined(Q_OS_MAC)
actions << m_ui->m_actionSwitchMainMenu;
#endif
actions << m_ui->m_actionSwitchToolBars;
actions << m_ui->m_actionSwitchListHeaders;
actions << m_ui->m_actionSwitchStatusBar;
@ -211,6 +215,11 @@ void FormMain::prepareMenus() {
m_ui->m_menuWebBrowserTabs->removeAction(m_ui->m_actionTabNewWebBrowser);
m_ui->m_menuWebBrowserTabs->setTitle(tr("Tabs"));
#endif
#if defined(Q_OS_MAC)
m_ui->m_actionSwitchMainMenu->setVisible(false);
m_ui->m_actionFullscreen->setVisible(false);
#endif
}
void FormMain::switchFullscreenMode() {

View File

@ -39,6 +39,7 @@
#include <QDebug>
#include <QTimer>
extern void disableWindowTabbing();
int main(int argc, char *argv[]) {
for (int i = 0; i < argc; i++) {
@ -85,6 +86,7 @@ int main(int argc, char *argv[]) {
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#ifdef Q_OS_MAC
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
disableWindowTabbing();
#endif
// Register needed metatypes.

View File

@ -0,0 +1,11 @@
#import <AppKit/AppKit.h>
// Disables auto window tabbing where supported, otherwise a no-op.
// See http://lists.qt-project.org/pipermail/interest/2016-September/024488.html
void disableWindowTabbing()
{
if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)]) {
NSWindow.allowsAutomaticWindowTabbing = NO;
}
}