forked from qt-creator/qt-creator
Avoid shortcuts with "Alt" on macOS
On macOS shortcuts with "Alt" are used for entering special characters, where "special" depends on keyboard layout and can mean e.g. '|' or '~'. Task-number: QTCREATORBUG-20873 Change-Id: Ifa70b95381ef48d2ba3b15a528a5dcfe43d53bfd Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -110,7 +110,8 @@ void AutotestPlugin::initializeMenuEntries()
|
|||||||
action->setIcon(Utils::Icons::RUN_SMALL_TOOLBAR.icon());
|
action->setIcon(Utils::Icons::RUN_SMALL_TOOLBAR.icon());
|
||||||
action->setToolTip(tr("Run All Tests"));
|
action->setToolTip(tr("Run All Tests"));
|
||||||
Command *command = ActionManager::registerAction(action, Constants::ACTION_RUN_ALL_ID);
|
Command *command = ActionManager::registerAction(action, Constants::ACTION_RUN_ALL_ID);
|
||||||
command->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+T,Alt+A")));
|
command->setDefaultKeySequence(
|
||||||
|
QKeySequence(useMacShortcuts ? tr("Ctrl+Meta+T, Ctrl+Meta+A") : tr("Alt+Shift+T,Alt+A")));
|
||||||
connect(action, &QAction::triggered, this, &AutotestPlugin::onRunAllTriggered);
|
connect(action, &QAction::triggered, this, &AutotestPlugin::onRunAllTriggered);
|
||||||
action->setEnabled(false);
|
action->setEnabled(false);
|
||||||
menu->addAction(command);
|
menu->addAction(command);
|
||||||
@@ -122,7 +123,8 @@ void AutotestPlugin::initializeMenuEntries()
|
|||||||
action->setIcon(runSelectedIcon.icon());
|
action->setIcon(runSelectedIcon.icon());
|
||||||
action->setToolTip(tr("Run Selected Tests"));
|
action->setToolTip(tr("Run Selected Tests"));
|
||||||
command = ActionManager::registerAction(action, Constants::ACTION_RUN_SELECTED_ID);
|
command = ActionManager::registerAction(action, Constants::ACTION_RUN_SELECTED_ID);
|
||||||
command->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+T,Alt+R")));
|
command->setDefaultKeySequence(
|
||||||
|
QKeySequence(useMacShortcuts ? tr("Ctrl+Meta+T, Ctrl+Meta+R") : tr("Alt+Shift+T,Alt+R")));
|
||||||
connect(action, &QAction::triggered, this, &AutotestPlugin::onRunSelectedTriggered);
|
connect(action, &QAction::triggered, this, &AutotestPlugin::onRunSelectedTriggered);
|
||||||
action->setEnabled(false);
|
action->setEnabled(false);
|
||||||
menu->addAction(command);
|
menu->addAction(command);
|
||||||
@@ -134,15 +136,17 @@ void AutotestPlugin::initializeMenuEntries()
|
|||||||
action->setIcon(runFileIcon.icon());
|
action->setIcon(runFileIcon.icon());
|
||||||
action->setToolTip(tr("Run Tests for Current File"));
|
action->setToolTip(tr("Run Tests for Current File"));
|
||||||
command = ActionManager::registerAction(action, Constants::ACTION_RUN_FILE_ID);
|
command = ActionManager::registerAction(action, Constants::ACTION_RUN_FILE_ID);
|
||||||
command->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+T,Alt+F")));
|
command->setDefaultKeySequence(
|
||||||
|
QKeySequence(useMacShortcuts ? tr("Ctrl+Meta+T, Ctrl+Meta+F") : tr("Alt+Shift+T,Alt+F")));
|
||||||
connect(action, &QAction::triggered, this, &AutotestPlugin::onRunFileTriggered);
|
connect(action, &QAction::triggered, this, &AutotestPlugin::onRunFileTriggered);
|
||||||
action->setEnabled(false);
|
action->setEnabled(false);
|
||||||
menu->addAction(command);
|
menu->addAction(command);
|
||||||
|
|
||||||
action = new QAction(tr("Re&scan Tests"), this);
|
action = new QAction(tr("Re&scan Tests"), this);
|
||||||
command = ActionManager::registerAction(action, Constants::ACTION_SCAN_ID);
|
command = ActionManager::registerAction(action, Constants::ACTION_SCAN_ID);
|
||||||
command->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+T,Alt+S")));
|
command->setDefaultKeySequence(
|
||||||
connect(action, &QAction::triggered, this, [] () {
|
QKeySequence(useMacShortcuts ? tr("Ctrl+Meta+T, Ctrl+Meta+S") : tr("Alt+Shift+T,Alt+S")));
|
||||||
|
connect(action, &QAction::triggered, this, []() {
|
||||||
TestTreeModel::instance()->parser()->updateTestTree();
|
TestTreeModel::instance()->parser()->updateTestTree();
|
||||||
});
|
});
|
||||||
menu->addAction(command);
|
menu->addAction(command);
|
||||||
|
@@ -259,9 +259,11 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) : QWidget(parent)
|
|||||||
if (!ActionManager::command(focusActionId)) {
|
if (!ActionManager::command(focusActionId)) {
|
||||||
auto focusDocumentInProjectTree = new QAction(tr("Focus Document in Project Tree"), this);
|
auto focusDocumentInProjectTree = new QAction(tr("Focus Document in Project Tree"), this);
|
||||||
Command *cmd = ActionManager::registerAction(focusDocumentInProjectTree, focusActionId);
|
Command *cmd = ActionManager::registerAction(focusDocumentInProjectTree, focusActionId);
|
||||||
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+L")));
|
cmd->setDefaultKeySequence(
|
||||||
connect(focusDocumentInProjectTree, &QAction::triggered,
|
QKeySequence(useMacShortcuts ? tr("Meta+Shift+L") : tr("Alt+Shift+L")));
|
||||||
this, [this]() { syncFromDocumentManager(); });
|
connect(focusDocumentInProjectTree, &QAction::triggered, this, [this]() {
|
||||||
|
syncFromDocumentManager();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
m_trimEmptyDirectoriesAction = new QAction(tr("Hide Empty Directories"), this);
|
m_trimEmptyDirectoriesAction = new QAction(tr("Hide Empty Directories"), this);
|
||||||
|
Reference in New Issue
Block a user