forked from qt-creator/qt-creator
OS X: Fix menu roles
Never use TextHeuristicRole because it doesn't work as expected with translations. Also remove some unneeded OS X scopes. Task-number: QTCREATORBUG-13101 Change-Id: If53ac36d9bee1782343e65d01a875b7e5434ff39 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -313,6 +313,10 @@ void Action::addOverrideAction(QAction *action, const Core::Context &context, bo
|
|||||||
{
|
{
|
||||||
if (Utils::HostOsInfo::isMacHost())
|
if (Utils::HostOsInfo::isMacHost())
|
||||||
action->setIconVisibleInMenu(false);
|
action->setIconVisibleInMenu(false);
|
||||||
|
// disallow TextHeuristic menu role, because it doesn't work with translations,
|
||||||
|
// e.g. QTCREATORBUG-13101
|
||||||
|
if (action->menuRole() == QAction::TextHeuristicRole)
|
||||||
|
action->setMenuRole(QAction::NoRole);
|
||||||
if (isEmpty())
|
if (isEmpty())
|
||||||
m_action->initialize(action);
|
m_action->initialize(action);
|
||||||
if (context.isEmpty()) {
|
if (context.isEmpty()) {
|
||||||
|
|||||||
@@ -562,9 +562,9 @@ void MainWindow::registerDefaultActions()
|
|||||||
// Exit Action
|
// Exit Action
|
||||||
icon = QIcon::fromTheme(QLatin1String("application-exit"));
|
icon = QIcon::fromTheme(QLatin1String("application-exit"));
|
||||||
m_exitAction = new QAction(icon, tr("E&xit"), this);
|
m_exitAction = new QAction(icon, tr("E&xit"), this);
|
||||||
|
m_exitAction->setMenuRole(QAction::QuitRole);
|
||||||
cmd = ActionManager::registerAction(m_exitAction, Constants::EXIT, globalContext);
|
cmd = ActionManager::registerAction(m_exitAction, Constants::EXIT, globalContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Q")));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Q")));
|
||||||
cmd->action()->setMenuRole(QAction::QuitRole);
|
|
||||||
mfile->addAction(cmd, Constants::G_FILE_OTHER);
|
mfile->addAction(cmd, Constants::G_FILE_OTHER);
|
||||||
connect(m_exitAction, SIGNAL(triggered()), this, SLOT(exit()));
|
connect(m_exitAction, SIGNAL(triggered()), this, SLOT(exit()));
|
||||||
|
|
||||||
@@ -633,11 +633,9 @@ void MainWindow::registerDefaultActions()
|
|||||||
mtools->addSeparator(globalContext, Constants::G_TOOLS_OPTIONS);
|
mtools->addSeparator(globalContext, Constants::G_TOOLS_OPTIONS);
|
||||||
|
|
||||||
m_optionsAction = new QAction(tr("&Options..."), this);
|
m_optionsAction = new QAction(tr("&Options..."), this);
|
||||||
|
m_optionsAction->setMenuRole(QAction::PreferencesRole);
|
||||||
cmd = ActionManager::registerAction(m_optionsAction, Constants::OPTIONS, globalContext);
|
cmd = ActionManager::registerAction(m_optionsAction, Constants::OPTIONS, globalContext);
|
||||||
if (UseMacShortcuts) {
|
cmd->setDefaultKeySequence(QKeySequence::Preferences);
|
||||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+,")));
|
|
||||||
cmd->action()->setMenuRole(QAction::PreferencesRole);
|
|
||||||
}
|
|
||||||
mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS);
|
mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS);
|
||||||
connect(m_optionsAction, SIGNAL(triggered()), this, SLOT(showOptionsDialog()));
|
connect(m_optionsAction, SIGNAL(triggered()), this, SLOT(showOptionsDialog()));
|
||||||
|
|
||||||
@@ -660,7 +658,6 @@ void MainWindow::registerDefaultActions()
|
|||||||
|
|
||||||
// Full Screen Action
|
// Full Screen Action
|
||||||
QAction *toggleFullScreenAction = new QAction(tr("Full Screen"), this);
|
QAction *toggleFullScreenAction = new QAction(tr("Full Screen"), this);
|
||||||
toggleFullScreenAction->setMenuRole(QAction::NoRole);
|
|
||||||
toggleFullScreenAction->setCheckable(!Utils::HostOsInfo::isMacHost());
|
toggleFullScreenAction->setCheckable(!Utils::HostOsInfo::isMacHost());
|
||||||
toggleFullScreenAction->setEnabled(false); // actual implementation in WindowSupport
|
toggleFullScreenAction->setEnabled(false); // actual implementation in WindowSupport
|
||||||
cmd = ActionManager::registerAction(toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
|
cmd = ActionManager::registerAction(toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
|
||||||
@@ -716,18 +713,16 @@ void MainWindow::registerDefaultActions()
|
|||||||
tmpaction = new QAction(icon, tr("About &Qt Creator"), this); // it's convention not to add dots to the about menu
|
tmpaction = new QAction(icon, tr("About &Qt Creator"), this); // it's convention not to add dots to the about menu
|
||||||
else
|
else
|
||||||
tmpaction = new QAction(icon, tr("About &Qt Creator..."), this);
|
tmpaction = new QAction(icon, tr("About &Qt Creator..."), this);
|
||||||
|
tmpaction->setMenuRole(QAction::AboutRole);
|
||||||
cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_QTCREATOR, globalContext);
|
cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_QTCREATOR, globalContext);
|
||||||
if (Utils::HostOsInfo::isMacHost())
|
|
||||||
cmd->action()->setMenuRole(QAction::ApplicationSpecificRole);
|
|
||||||
mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
|
mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
|
||||||
tmpaction->setEnabled(true);
|
tmpaction->setEnabled(true);
|
||||||
connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutQtCreator()));
|
connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutQtCreator()));
|
||||||
|
|
||||||
//About Plugins Action
|
//About Plugins Action
|
||||||
tmpaction = new QAction(tr("About &Plugins..."), this);
|
tmpaction = new QAction(tr("About &Plugins..."), this);
|
||||||
|
tmpaction->setMenuRole(QAction::ApplicationSpecificRole);
|
||||||
cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_PLUGINS, globalContext);
|
cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_PLUGINS, globalContext);
|
||||||
if (Utils::HostOsInfo::isMacHost())
|
|
||||||
cmd->action()->setMenuRole(QAction::ApplicationSpecificRole);
|
|
||||||
mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
|
mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
|
||||||
tmpaction->setEnabled(true);
|
tmpaction->setEnabled(true);
|
||||||
connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutPlugins()));
|
connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutPlugins()));
|
||||||
|
|||||||
@@ -650,7 +650,6 @@ void FormEditorData::setupActions()
|
|||||||
|
|
||||||
mformtools->addSeparator(m_contexts, Core::Constants::G_DEFAULT_THREE);
|
mformtools->addSeparator(m_contexts, Core::Constants::G_DEFAULT_THREE);
|
||||||
m_actionAboutPlugins = new QAction(tr("About Qt Designer Plugins..."), m_instance);
|
m_actionAboutPlugins = new QAction(tr("About Qt Designer Plugins..."), m_instance);
|
||||||
m_actionAboutPlugins->setMenuRole(QAction::NoRole);
|
|
||||||
addToolAction(m_actionAboutPlugins, m_contexts, "FormEditor.AboutPlugins", mformtools,
|
addToolAction(m_actionAboutPlugins, m_contexts, "FormEditor.AboutPlugins", mformtools,
|
||||||
QString(), Core::Constants::G_DEFAULT_THREE);
|
QString(), Core::Constants::G_DEFAULT_THREE);
|
||||||
QObject::connect(m_actionAboutPlugins, &QAction::triggered,
|
QObject::connect(m_actionAboutPlugins, &QAction::triggered,
|
||||||
|
|||||||
Reference in New Issue
Block a user