macOS: Fix that some actions still had icon in menu

For example when toolbars showed a menu for actions that no longer fit
(e.g. open diff viewer, reduce window size until the synchronize and
switch view buttons vanish).

Use the application flag to disable icons in menus on macOS globally
instead of doing that individually on the actions.

Change-Id: I3b682f48ee0e866f0f0d5bb0834690937f427d7f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Eike Ziller
2016-11-15 16:28:14 +01:00
parent 37076e8c33
commit 45216d5c1a
3 changed files with 2 additions and 8 deletions

View File

@@ -163,6 +163,8 @@ ActionManager::ActionManager(QObject *parent)
{ {
m_instance = this; m_instance = this;
d = new ActionManagerPrivate; d = new ActionManagerPrivate;
if (Utils::HostOsInfo::isMacHost())
QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
} }
/*! /*!

View File

@@ -306,8 +306,6 @@ static QString msgActionWarning(QAction *newAction, Id id, QAction *oldAction)
void Action::addOverrideAction(QAction *action, const Context &context, bool scriptable) void Action::addOverrideAction(QAction *action, const Context &context, bool scriptable)
{ {
if (Utils::HostOsInfo::isMacHost())
action->setIconVisibleInMenu(false);
// disallow TextHeuristic menu role, because it doesn't work with translations, // disallow TextHeuristic menu role, because it doesn't work with translations,
// e.g. QTCREATORBUG-13101 // e.g. QTCREATORBUG-13101
if (action->menuRole() == QAction::TextHeuristicRole) if (action->menuRole() == QAction::TextHeuristicRole)

View File

@@ -159,12 +159,6 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
d->m_forwardButton->setDefaultAction(d->m_goForwardAction); d->m_forwardButton->setDefaultAction(d->m_goForwardAction);
if (Utils::HostOsInfo::isMacHost()) {
d->m_horizontalSplitAction->setIconVisibleInMenu(false);
d->m_verticalSplitAction->setIconVisibleInMenu(false);
d->m_splitNewWindowAction->setIconVisibleInMenu(false);
}
d->m_splitButton->setIcon(Utils::Icons::SPLIT_HORIZONTAL_TOOLBAR.icon()); d->m_splitButton->setIcon(Utils::Icons::SPLIT_HORIZONTAL_TOOLBAR.icon());
d->m_splitButton->setToolTip(tr("Split")); d->m_splitButton->setToolTip(tr("Split"));
d->m_splitButton->setPopupMode(QToolButton::InstantPopup); d->m_splitButton->setPopupMode(QToolButton::InstantPopup);