forked from qt-creator/qt-creator
macOS: Fix missing "Search" item in help menu
Define the menu as the help menu directly in the the NSApplication, since the OS built-in heuristics based on the menu name easily fails. Fixes: QTCREATORBUG-24751 Change-Id: I9aa50a46099e295ec0c38ee8a9e88d75d41c74ad Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -253,6 +253,13 @@ void Theme::setInitialPalette(Theme *initTheme)
|
|||||||
initialPalette();
|
initialPalette();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Theme::setHelpMenu(QMenu *menu)
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
Internal::setMacOSHelpMenu(menu);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
QPalette Theme::initialPalette()
|
QPalette Theme::initialPalette()
|
||||||
{
|
{
|
||||||
static QPalette palette = copyPalette(QApplication::palette());
|
static QPalette palette = copyPalette(QApplication::palette());
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QMenu;
|
||||||
class QPalette;
|
class QPalette;
|
||||||
class QSettings;
|
class QSettings;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
@@ -473,6 +474,8 @@ public:
|
|||||||
|
|
||||||
static void setInitialPalette(Theme *initTheme);
|
static void setInitialPalette(Theme *initTheme);
|
||||||
|
|
||||||
|
static void setHelpMenu(QMenu *menu);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Theme(Theme *originTheme, QObject *parent = nullptr);
|
Theme(Theme *originTheme, QObject *parent = nullptr);
|
||||||
ThemePrivate *d;
|
ThemePrivate *d;
|
||||||
|
|||||||
@@ -3,11 +3,18 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <qglobal.h>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QMenu;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
void forceMacAppearance(bool dark);
|
void forceMacAppearance(bool dark);
|
||||||
bool currentAppearanceIsDark();
|
bool currentAppearanceIsDark();
|
||||||
|
void setMacOSHelpMenu(QMenu *menu);
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // Utils
|
} // Utils
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "theme_mac.h"
|
#include "theme_mac.h"
|
||||||
|
|
||||||
#include <qglobal.h>
|
#include <QMenu>
|
||||||
#include <QOperatingSystemVersion>
|
#include <QOperatingSystemVersion>
|
||||||
|
|
||||||
#include <AppKit/AppKit.h>
|
#include <AppKit/AppKit.h>
|
||||||
@@ -47,5 +47,10 @@ bool currentAppearanceIsDark()
|
|||||||
return !currentAppearanceMatches(false /*==light*/);
|
return !currentAppearanceMatches(false /*==light*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setMacOSHelpMenu(QMenu *menu)
|
||||||
|
{
|
||||||
|
NSApp.helpMenu = menu->toNSMenu();
|
||||||
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // Utils
|
} // Utils
|
||||||
|
|||||||
@@ -514,6 +514,7 @@ void MainWindow::registerDefaultContainers()
|
|||||||
ac = ActionManager::createMenu(Constants::M_HELP);
|
ac = ActionManager::createMenu(Constants::M_HELP);
|
||||||
menubar->addMenu(ac, Constants::G_HELP);
|
menubar->addMenu(ac, Constants::G_HELP);
|
||||||
ac->menu()->setTitle(tr("&Help"));
|
ac->menu()->setTitle(tr("&Help"));
|
||||||
|
Theme::setHelpMenu(ac->menu());
|
||||||
ac->appendGroup(Constants::G_HELP_HELP);
|
ac->appendGroup(Constants::G_HELP_HELP);
|
||||||
ac->appendGroup(Constants::G_HELP_SUPPORT);
|
ac->appendGroup(Constants::G_HELP_SUPPORT);
|
||||||
ac->appendGroup(Constants::G_HELP_ABOUT);
|
ac->appendGroup(Constants::G_HELP_ABOUT);
|
||||||
|
|||||||
Reference in New Issue
Block a user