Core: Rename ActionBuilder::setOn* to addOn*

There could be multiple connections.

Change-Id: I7dbca9d24599f776b7d1f1bfa11826e3eeb5640a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2023-12-13 12:29:46 +01:00
parent 3b7d29d2a1
commit b442ca3873
28 changed files with 158 additions and 158 deletions

View File

@@ -191,7 +191,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
runAll.setDefaultKeySequence(Tr::tr("Ctrl+Meta+T, Ctrl+Meta+A"), Tr::tr("Alt+Shift+T,Alt+A"));
runAll.addToContainer(Constants::MENU_ID);
runAll.setEnabled(false);
runAll.setOnTriggered(this, [this] { onRunAllTriggered(TestRunMode::Run); });
runAll.addOnTriggered(this, [this] { onRunAllTriggered(TestRunMode::Run); });
ActionBuilder runAllNoDeploy(this, Constants::ACTION_RUN_ALL_NODEPLOY_ID);
runAllNoDeploy.setText(Tr::tr("Run All Tests Without Deployment"));
@@ -200,7 +200,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
runAllNoDeploy.setDefaultKeySequence(Tr::tr("Ctrl+Meta+T, Ctrl+Meta+E"), Tr::tr("Alt+Shift+T,Alt+E"));
runAllNoDeploy.addToContainer(Constants::MENU_ID);
runAllNoDeploy.setEnabled(false);
runAllNoDeploy.setOnTriggered(this, [this] { onRunAllTriggered(TestRunMode::RunWithoutDeploy); });
runAllNoDeploy.addOnTriggered(this, [this] { onRunAllTriggered(TestRunMode::RunWithoutDeploy); });
ActionBuilder runSelected(this, Constants::ACTION_RUN_SELECTED_ID);
runSelected.setText(Tr::tr("&Run Selected Tests"));
@@ -209,7 +209,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
runSelected.setDefaultKeySequence(Tr::tr("Ctrl+Meta+T, Ctrl+Meta+R"), Tr::tr("Alt+Shift+T,Alt+R"));
runSelected.addToContainer(Constants::MENU_ID);
runSelected.setEnabled(false);
runSelected.setOnTriggered(this, [this] { onRunSelectedTriggered(TestRunMode::Run); });
runSelected.addOnTriggered(this, [this] { onRunSelectedTriggered(TestRunMode::Run); });
ActionBuilder runSelectedNoDeploy(this, Constants::ACTION_RUN_SELECTED_NODEPLOY_ID);
runSelectedNoDeploy.setText(Tr::tr("&Run Selected Tests Without Deployment"));
@@ -218,7 +218,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
runSelectedNoDeploy.setDefaultKeySequence(Tr::tr("Ctrl+Meta+T, Ctrl+Meta+W"), Tr::tr("Alt+Shift+T,Alt+W"));
runSelectedNoDeploy.addToContainer(Constants::MENU_ID);
runSelectedNoDeploy.setEnabled(false);
runSelectedNoDeploy.setOnTriggered(this, [this] { onRunSelectedTriggered(TestRunMode::RunWithoutDeploy); });
runSelectedNoDeploy.addOnTriggered(this, [this] { onRunSelectedTriggered(TestRunMode::RunWithoutDeploy); });
ActionBuilder runFailed(this, Constants::ACTION_RUN_FAILED_ID);
runFailed.setText(Tr::tr("Run &Failed Tests"));
@@ -227,7 +227,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
runFailed.setDefaultKeySequence(Tr::tr("Ctrl+Meta+T, Ctrl+Meta+F"), Tr::tr("Alt+Shift+T,Alt+F"));
runFailed.addToContainer(Constants::MENU_ID);
runFailed.setEnabled(false);
runFailed.setOnTriggered(this, [this] { onRunFailedTriggered(); });
runFailed.addOnTriggered(this, [this] { onRunFailedTriggered(); });
ActionBuilder runCurrent(this, Constants::ACTION_RUN_FILE_ID);
runCurrent.setText(Tr::tr("Run Tests for &Current File"));
@@ -236,7 +236,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
runCurrent.setDefaultKeySequence(Tr::tr("Ctrl+Meta+T, Ctrl+Meta+C"), Tr::tr("Alt+Shift+T,Alt+C"));
runCurrent.addToContainer(Constants::MENU_ID);
runCurrent.setEnabled(false);
runCurrent.setOnTriggered(this, [this] { onRunFileTriggered(); });
runCurrent.addOnTriggered(this, [this] { onRunFileTriggered(); });
ActionBuilder disableTemp(this, Constants::ACTION_DISABLE_TMP);
disableTemp.setText(Tr::tr("Disable Temporarily"));
@@ -244,13 +244,13 @@ void AutotestPluginPrivate::initializeMenuEntries()
"re-enabling, or restarting Qt Creator."));
disableTemp.setCheckable(true);
disableTemp.addToContainer(Constants::MENU_ID);
disableTemp.setOnTriggered(this, [this](bool on) { onDisableTemporarily(on); });
disableTemp.addOnTriggered(this, [this](bool on) { onDisableTemporarily(on); });
ActionBuilder rescan(this, Constants::ACTION_SCAN_ID);
rescan.setText(Tr::tr("Re&scan Tests"));
rescan.setDefaultKeySequence(Tr::tr("Ctrl+Meta+T, Ctrl+Meta+S"), Tr::tr("Alt+Shift+T,Alt+S"));
rescan.addToContainer(Constants::MENU_ID);
rescan.setOnTriggered(this, [] {
rescan.addOnTriggered(this, [] {
if (dd->m_testCodeParser.state() == TestCodeParser::DisabledTemporarily)
dd->onDisableTemporarily(false); // Rescan Test should explicitly re-enable
else
@@ -299,14 +299,14 @@ void AutotestPlugin::extensionsInitialized()
runTest.setEnabled(false);
runTest.setIcon(Utils::Icons::RUN_SMALL.icon());
runTest.addToContainer(menuId);
runTest.setOnTriggered([] { dd->onRunUnderCursorTriggered(TestRunMode::Run); });
runTest.addOnTriggered([] { dd->onRunUnderCursorTriggered(TestRunMode::Run); });
ActionBuilder runTestNoDeploy(this, Constants::ACTION_RUN_UCURSOR_NODEPLOY);
runTestNoDeploy.setText(Tr::tr("Run Test Without Deployment"));
runTestNoDeploy.setIcon(Utils::Icons::RUN_SMALL.icon());
runTestNoDeploy.setEnabled(false);
runTestNoDeploy.addToContainer(menuId);
runTestNoDeploy.setOnTriggered(
runTestNoDeploy.addOnTriggered(
[] { dd->onRunUnderCursorTriggered(TestRunMode::RunWithoutDeploy); });
ActionBuilder debugTest(this, Constants::ACTION_RUN_DBG_UCURSOR);
@@ -314,14 +314,14 @@ void AutotestPlugin::extensionsInitialized()
debugTest.setIcon(ProjectExplorer::Icons::DEBUG_START_SMALL.icon());
debugTest.setEnabled(false);
debugTest.addToContainer(menuId);
debugTest.setOnTriggered([] { dd->onRunUnderCursorTriggered(TestRunMode::Debug); });
debugTest.addOnTriggered([] { dd->onRunUnderCursorTriggered(TestRunMode::Debug); });
ActionBuilder debugTestNoDeploy(this, Constants::ACTION_RUN_DBG_UCURSOR_NODEPLOY);
debugTestNoDeploy.setText(Tr::tr("Debug Test Without Deployment"));
debugTestNoDeploy.setIcon(ProjectExplorer::Icons::DEBUG_START_SMALL.icon());
debugTestNoDeploy.setEnabled(false);
debugTestNoDeploy.addToContainer(menuId);
debugTestNoDeploy.setOnTriggered(
debugTestNoDeploy.addOnTriggered(
[] { dd->onRunUnderCursorTriggered(TestRunMode::DebugWithoutDeploy); });
}

View File

@@ -362,7 +362,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
annotateFile.bindContextAction(&m_annotateFile);
annotateFile.setCommandAttribute(Command::CA_UpdateText);
annotateFile.addToContainer(bazaarMenuId);
annotateFile.setOnTriggered(this, [this] { annotateCurrentFile(); });
annotateFile.addOnTriggered(this, [this] { annotateCurrentFile(); });
m_commandLocator->appendCommand(annotateFile.command());
ActionBuilder diffFile(this, DIFF);
@@ -372,7 +372,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
diffFile.setCommandAttribute(Command::CA_UpdateText);
diffFile.setDefaultKeySequence(Tr::tr("Meta+Z,Meta+D"), Tr::tr("Alt+Z,Alt+D"));
diffFile.addToContainer(bazaarMenuId);
diffFile.setOnTriggered(this, [this] { diffCurrentFile(); });
diffFile.addOnTriggered(this, [this] { diffCurrentFile(); });
m_commandLocator->appendCommand(diffFile.command());
ActionBuilder logFile(this, LOG);
@@ -382,7 +382,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
logFile.setCommandAttribute(Command::CA_UpdateText);
logFile.setDefaultKeySequence(Tr::tr("Meta+Z,Meta+L"), Tr::tr("Alt+Z,Alt+L"));
logFile.addToContainer(bazaarMenuId);
logFile.setOnTriggered(this, [this] { logCurrentFile(); });
logFile.addOnTriggered(this, [this] { logCurrentFile(); });
m_commandLocator->appendCommand(logFile.command());
ActionBuilder statusFile(this, STATUS);
@@ -392,7 +392,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
statusFile.setCommandAttribute(Command::CA_UpdateText);
statusFile.setDefaultKeySequence(Tr::tr("Meta+Z,Meta+S"), Tr::tr("Alt+Z,Alt+S"));
statusFile.addToContainer(bazaarMenuId);
statusFile.setOnTriggered(this, [this] { statusCurrentFile(); });
statusFile.addOnTriggered(this, [this] { statusCurrentFile(); });
m_commandLocator->appendCommand(statusFile.command());
bazaarMenu->addSeparator(context);
@@ -403,7 +403,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
addAction.setContext(context);
addAction.setCommandAttribute(Command::CA_UpdateText);
addAction.addToContainer(bazaarMenuId);
addAction.setOnTriggered(this, [this] { addCurrentFile(); });
addAction.addOnTriggered(this, [this] { addCurrentFile(); });
m_commandLocator->appendCommand(addAction.command());
ActionBuilder deleteAction(this, DELETE);
@@ -412,7 +412,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
deleteAction.bindContextAction(&m_deleteAction);
deleteAction.setCommandAttribute(Command::CA_UpdateText);
deleteAction.addToContainer(bazaarMenuId);
deleteAction.setOnTriggered(this, [this] { promptToDeleteCurrentFile(); });
deleteAction.addOnTriggered(this, [this] { promptToDeleteCurrentFile(); });
m_commandLocator->appendCommand(deleteAction.command());
ActionBuilder revertFile(this, REVERT);
@@ -421,7 +421,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
revertFile.bindContextAction(&m_revertFile);
revertFile.setCommandAttribute(Command::CA_UpdateText);
revertFile.addToContainer(bazaarMenuId);
revertFile.setOnTriggered(this, [this] { revertCurrentFile(); });
revertFile.addOnTriggered(this, [this] { revertCurrentFile(); });
m_commandLocator->appendCommand(revertFile.command());
bazaarMenu->addSeparator(context);
@@ -432,7 +432,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
diffMulti.setText(Tr::tr("Diff"));
diffMulti.setContext(context);
diffMulti.addToContainer(bazaarMenuId);
diffMulti.setOnTriggered(this, [this] { diffRepository(); });
diffMulti.addOnTriggered(this, [this] { diffRepository(); });
m_repositoryActionList.append(diffMulti.contextAction());
m_commandLocator->appendCommand(diffMulti.command());
@@ -440,7 +440,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
logMulti.setText(Tr::tr("Log"));
logMulti.setContext(context);
logMulti.addToContainer(bazaarMenuId);
logMulti.setOnTriggered(this, [this] { logRepository(); });
logMulti.addOnTriggered(this, [this] { logRepository(); });
m_repositoryActionList.append(logMulti.contextAction());
m_commandLocator->appendCommand(logMulti.command());
@@ -448,7 +448,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
revertMulti.setText(Tr::tr("Revert..."));
revertMulti.setContext(context);
revertMulti.addToContainer(bazaarMenuId);
revertMulti.setOnTriggered(this, [this] { revertAll(); });
revertMulti.addOnTriggered(this, [this] { revertAll(); });
m_repositoryActionList.append(revertMulti.contextAction());
m_commandLocator->appendCommand(revertMulti.command());
@@ -456,7 +456,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
statusMulti.setText(Tr::tr("Status"));
statusMulti.setContext(context);
statusMulti.addToContainer(bazaarMenuId);
statusMulti.setOnTriggered(this, [this] { this->statusMulti(); });
statusMulti.addOnTriggered(this, [this] { this->statusMulti(); });
m_repositoryActionList.append(statusMulti.contextAction());
m_commandLocator->appendCommand(statusMulti.command());
@@ -468,7 +468,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
pull.setText(Tr::tr("Pull..."));
pull.setContext(context);
pull.addToContainer(bazaarMenuId);
pull.setOnTriggered(this, [this] { this->pull(); });
pull.addOnTriggered(this, [this] { this->pull(); });
m_repositoryActionList.append(pull.contextAction());
m_commandLocator->appendCommand(pull.command());
@@ -476,7 +476,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
push.setText(Tr::tr("Push..."));
push.setContext(context);
push.addToContainer(bazaarMenuId);
push.setOnTriggered(this, [this] { this->push(); });
push.addOnTriggered(this, [this] { this->push(); });
m_repositoryActionList.append(push.contextAction());
m_commandLocator->appendCommand(push.command());
@@ -484,7 +484,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
update.setText(Tr::tr("Update..."));
update.setContext(context);
update.addToContainer(bazaarMenuId);
update.setOnTriggered(this, [this] { this->update(); });
update.addOnTriggered(this, [this] { this->update(); });
m_repositoryActionList.append(update.contextAction());
m_commandLocator->appendCommand(update.command());
@@ -493,7 +493,7 @@ BazaarPluginPrivate::BazaarPluginPrivate()
commit.setContext(context);
commit.addToContainer(bazaarMenuId);
commit.setDefaultKeySequence(Tr::tr("Meta+Z,Meta+C"), Tr::tr("Alt+Z,Alt+C"));
commit.setOnTriggered(this, [this] { this->commit(); });
commit.addOnTriggered(this, [this] { this->commit(); });
m_repositoryActionList.append(commit.contextAction());
m_commandLocator->appendCommand(commit.command());
@@ -501,14 +501,14 @@ BazaarPluginPrivate::BazaarPluginPrivate()
uncommit.setText(Tr::tr("Uncommit..."));
uncommit.setContext(context);
uncommit.addToContainer(bazaarMenuId);
uncommit.setOnTriggered(this, [this] { this->uncommit(); });
uncommit.addOnTriggered(this, [this] { this->uncommit(); });
m_repositoryActionList.append(uncommit.contextAction());
m_commandLocator->appendCommand(uncommit.command());
ActionBuilder createRepository(this, CREATE_REPOSITORY);
createRepository.setText(Tr::tr("Create Repository..."));
createRepository.addToContainer(bazaarMenuId);
createRepository.setOnTriggered(this, [this] { this->createRepository(); });
createRepository.addOnTriggered(this, [this] { this->createRepository(); });
bazaarMenu->addSeparator(context);

View File

@@ -247,7 +247,7 @@ public:
formatFile.setText(msgFormatCurrentFile());
formatFile.bindContextAction(&m_formatFile);
formatFile.addToContainer(menuId);
formatFile.setOnTriggered(this, [this] { this->formatFile(); });
formatFile.addOnTriggered(this, [this] { this->formatFile(); });
Core::ActionManager::actionContainer(Constants::MENU_ID)->addMenu(menu);

View File

@@ -323,25 +323,25 @@ public:
formatFile.setText(msgFormatCurrentFile());
formatFile.bindContextAction(&m_formatFile);
formatFile.addToContainer(menuId);
formatFile.setOnTriggered(this, [this] { this->formatFile(); });
formatFile.addOnTriggered(this, [this] { this->formatFile(); });
Core::ActionBuilder formatLines(this, "ClangFormat.FormatLines");
formatLines.setText(msgFormatLines());
formatLines.bindContextAction(&m_formatLines);
formatLines.addToContainer(menuId);
formatLines.setOnTriggered(this, [this] { this->formatLines(); });
formatLines.addOnTriggered(this, [this] { this->formatLines(); });
Core::ActionBuilder formatAtCursor(this, "ClangFormat.FormatAtCursor");
formatAtCursor.setText(msgFormatAtCursor());
formatAtCursor.bindContextAction(&m_formatRange);
formatAtCursor.addToContainer(menuId);
formatAtCursor.setOnTriggered(this, [this] { this->formatAtCursor(); });
formatAtCursor.addOnTriggered(this, [this] { this->formatAtCursor(); });
Core::ActionBuilder formatDisable(this, "ClangFormat.DisableFormattingSelectedText");
formatDisable.setText(msgDisableFormattingSelectedText());
formatDisable.bindContextAction(&m_disableFormattingSelectedText);
formatDisable.addToContainer(menuId);
formatDisable.setOnTriggered(this, [this] { disableFormattingSelectedText(); });
formatDisable.addOnTriggered(this, [this] { disableFormattingSelectedText(); });
Core::ActionManager::actionContainer(Constants::MENU_ID)->addMenu(menu);

View File

@@ -243,13 +243,13 @@ public:
formatFile.setText(msgFormatCurrentFile());
formatFile.bindContextAction(&m_formatFile);
formatFile.addToContainer(menuId);
formatFile.setOnTriggered(this, [this] { this->formatFile(); });
formatFile.addOnTriggered(this, [this] { this->formatFile(); });
Core::ActionBuilder formatRange(this, "Uncrustify.FormatSelectedText");
formatRange.setText(msgFormatSelectedText());
formatRange.bindContextAction(&m_formatRange);
formatRange.addToContainer(menuId);
formatRange.setOnTriggered(this, [this] { this->formatSelectedText(); });
formatRange.addOnTriggered(this, [this] { this->formatSelectedText(); });
Core::ActionManager::actionContainer(Constants::MENU_ID)->addMenu(menu);

View File

@@ -85,7 +85,7 @@ void registerFlashAction(QObject *parentForAction)
ActionBuilder flashAction(parentForAction, flashActionId);
flashAction.setText(Tr::tr("Flash Boot to Qt Device"));
flashAction.addToContainer(Core::Constants::M_TOOLS, flashActionId);
flashAction.setOnTriggered(&startFlashingWizard);
flashAction.addOnTriggered(&startFlashingWizard);
}
class QdbDeployStepFactory : public BuildStepFactory

View File

@@ -86,7 +86,7 @@ void ClangCodeModelPlugin::initialize()
ActionBuilder updateStaleIndexEntries(this, "ClangCodeModel.UpdateStaleIndexEntries");
updateStaleIndexEntries.setText(Tr::tr("Update Potentially Stale Clangd Index Entries"));
updateStaleIndexEntries.setOnTriggered(this, &ClangModelManagerSupport::updateStaleIndexEntries);
updateStaleIndexEntries.addOnTriggered(this, &ClangModelManagerSupport::updateStaleIndexEntries);
updateStaleIndexEntries.addToContainer(CppEditor::Constants::M_TOOLS_CPP);
updateStaleIndexEntries.addToContainer(CppEditor::Constants::M_CONTEXT);

View File

@@ -76,7 +76,7 @@ void ClangFormatPlugin::initialize()
ActionBuilder openConfig(this, Constants::OPEN_CURRENT_CONFIG_ID);
openConfig.setText(Tr::tr("Open Used .clang-format Configuration File"));
openConfig.addToContainer(CppEditor::Constants::M_CONTEXT);
openConfig.setOnTriggered([action=openConfig.contextAction()] {
openConfig.addOnTriggered([action=openConfig.contextAction()] {
const FilePath fileName = FilePath::fromVariant(action->data());
if (!fileName.isEmpty())
EditorManager::openEditor(configForFile(fileName));

View File

@@ -62,14 +62,14 @@ CMakeManager::CMakeManager()
runCMakeAction.bindContextAction(&m_runCMakeAction);
runCMakeAction.setCommandAttribute(Command::CA_Hide);
runCMakeAction.addToContainer(PEC::M_BUILDPROJECT, PEC::G_BUILD_BUILD);
runCMakeAction.setOnTriggered(this, [this] { runCMake(ProjectManager::startupBuildSystem()); });
runCMakeAction.addOnTriggered(this, [this] { runCMake(ProjectManager::startupBuildSystem()); });
ActionBuilder clearCMakeCacheAction(this, Constants::CLEAR_CMAKE_CACHE);
clearCMakeCacheAction.setText(Tr::tr("Clear CMake Configuration"));
clearCMakeCacheAction.bindContextAction(&m_clearCMakeCacheAction);
clearCMakeCacheAction.setCommandAttribute(Command::CA_Hide);
clearCMakeCacheAction.addToContainer(PEC::M_BUILDPROJECT, PEC::G_BUILD_BUILD);
clearCMakeCacheAction.setOnTriggered(this, [this] {
clearCMakeCacheAction.addOnTriggered(this, [this] {
clearCMakeCache(ProjectManager::startupBuildSystem());
});
@@ -80,7 +80,7 @@ CMakeManager::CMakeManager()
runCMakeActionContextMenu.bindContextAction(&m_runCMakeActionContextMenu);
runCMakeActionContextMenu.setCommandAttribute(Command::CA_Hide);
runCMakeActionContextMenu.addToContainer(PEC::M_PROJECTCONTEXT, PEC::G_PROJECT_BUILD);
runCMakeActionContextMenu.setOnTriggered(this, [this] {
runCMakeActionContextMenu.addOnTriggered(this, [this] {
runCMake(ProjectTree::currentBuildSystem());
});
@@ -90,14 +90,14 @@ CMakeManager::CMakeManager()
buildFileContextAction.setContext(projectContext);
buildFileContextAction.setCommandAttribute(Command::CA_Hide);
buildFileContextAction.addToContainer(PEC::M_FILECONTEXT, PEC::G_FILE_OTHER);
buildFileContextAction.setOnTriggered(this, [this] { buildFileContextMenu(); });
buildFileContextAction.addOnTriggered(this, [this] { buildFileContextMenu(); });
ActionBuilder rescanProjectAction(this, Constants::RESCAN_PROJECT);
rescanProjectAction.setText(Tr::tr("Rescan Project"));
rescanProjectAction.bindContextAction(&m_rescanProjectAction);
rescanProjectAction.setCommandAttribute(Command::CA_Hide);
rescanProjectAction.addToContainer(PEC::M_BUILDPROJECT, PEC::G_BUILD_BUILD);
rescanProjectAction.setOnTriggered(this, [this] {
rescanProjectAction.addOnTriggered(this, [this] {
rescanProject(ProjectTree::currentBuildSystem());
});
@@ -107,7 +107,7 @@ CMakeManager::CMakeManager()
reloadCMakePresetsAction.bindContextAction(&m_reloadCMakePresetsAction);
reloadCMakePresetsAction.setCommandAttribute(Command::CA_Hide);
reloadCMakePresetsAction.addToContainer(PEC::M_BUILDPROJECT, PEC::G_BUILD_BUILD);
reloadCMakePresetsAction.setOnTriggered(this, [this] { reloadCMakePresets(); });
reloadCMakePresetsAction.addOnTriggered(this, [this] { reloadCMakePresets(); });
m_buildFileAction = new Utils::ParameterAction(Tr::tr("Build File"),
Tr::tr("Build File \"%1\""),
@@ -131,7 +131,7 @@ CMakeManager::CMakeManager()
cmakeProfilerAction.addToContainer(Debugger::Constants::M_DEBUG_ANALYZER,
Debugger::Constants::G_ANALYZER_TOOLS,
false);
cmakeProfilerAction.setOnTriggered(this, [this] {
cmakeProfilerAction.addOnTriggered(this, [this] {
runCMakeWithProfiling(ProjectManager::startupBuildSystem());
});
@@ -148,7 +148,7 @@ CMakeManager::CMakeManager()
cmakeDebuggerAction.bindContextAction(&m_cmakeDebuggerAction);
cmakeDebuggerAction.setCommandDescription(m_cmakeDebuggerAction->text());
cmakeDebuggerAction.addToContainer(PEC::M_DEBUG_STARTDEBUGGING, Constants::CMAKE_DEBUGGING_GROUP);
cmakeDebuggerAction.setOnTriggered(this, [] {
cmakeDebuggerAction.addOnTriggered(this, [] {
ProjectExplorerPlugin::runStartupProject(PEC::DAP_CMAKE_DEBUG_RUN_MODE,
/*forceSkipDeploy=*/true);
});

View File

@@ -65,7 +65,7 @@ public:
requestAction.setText(Tr::tr("Request Copilot Suggestion"));
requestAction.setToolTip(Tr::tr(
"Request Copilot suggestion at the current editor's cursor position."));
requestAction.setOnTriggered(this, [this] {
requestAction.addOnTriggered(this, [this] {
if (auto editor = TextEditor::TextEditorWidget::currentTextEditorWidget()) {
if (m_client && m_client->reachable())
m_client->requestCompletions(editor);
@@ -76,7 +76,7 @@ public:
nextSuggestionAction.setText(Tr::tr("Show Next Copilot Suggestion"));
nextSuggestionAction.setToolTip(Tr::tr(
"Cycles through the received Copilot Suggestions showing the next available Suggestion."));
nextSuggestionAction.setOnTriggered(this, [] {
nextSuggestionAction.addOnTriggered(this, [] {
if (auto editor = TextEditor::TextEditorWidget::currentTextEditorWidget())
cycleSuggestion(editor, Next);
});
@@ -85,7 +85,7 @@ public:
previousSuggestionAction.setText(Tr::tr("Show Previous Copilot Suggestion"));
previousSuggestionAction.setToolTip(Tr::tr("Cycles through the received Copilot Suggestions "
"showing the previous available Suggestion."));
previousSuggestionAction.setOnTriggered(this, [] {
previousSuggestionAction.addOnTriggered(this, [] {
if (auto editor = TextEditor::TextEditorWidget::currentTextEditorWidget())
cycleSuggestion(editor, Previous);
});
@@ -93,7 +93,7 @@ public:
ActionBuilder disableAction(this, Constants::COPILOT_DISABLE);
disableAction.setText(Tr::tr("Disable Copilot"));
disableAction.setToolTip(Tr::tr("Disable Copilot."));
disableAction.setOnTriggered(this, [] {
disableAction.addOnTriggered(this, [] {
settings().enableCopilot.setValue(true);
settings().apply();
});
@@ -101,7 +101,7 @@ public:
ActionBuilder enableAction(this, Constants::COPILOT_ENABLE);
enableAction.setText(Tr::tr("Enable Copilot"));
enableAction.setToolTip(Tr::tr("Enable Copilot."));
enableAction.setOnTriggered(this, [] {
enableAction.addOnTriggered(this, [] {
settings().enableCopilot.setValue(false);
settings().apply();
});
@@ -111,7 +111,7 @@ public:
toggleAction.setCheckable(true);
toggleAction.setChecked(settings().enableCopilot());
toggleAction.setIcon(COPILOT_ICON.icon());
toggleAction.setOnTriggered(this, [](bool checked) {
toggleAction.addOnTriggered(this, [](bool checked) {
settings().enableCopilot.setValue(checked);
settings().apply();
});

View File

@@ -141,7 +141,7 @@ void ActionBuilder::addToContainer(Id containerId, Id groupId, bool needsToExist
QTC_CHECK(!needsToExist);
}
void ActionBuilder::setOnTriggered(const std::function<void ()> &func)
void ActionBuilder::addOnTriggered(const std::function<void ()> &func)
{
QObject::connect(d->contextAction, &QAction::triggered, d->contextAction, func);
}

View File

@@ -43,10 +43,10 @@ public:
void setCommandAttribute(Core::Command::CommandAttribute attr);
void setCommandDescription(const QString &desc);
void addToContainer(Utils::Id containerId, Utils::Id groupId = {}, bool needsToExist = true);
void setOnTriggered(const std::function<void()> &func);
void addOnTriggered(const std::function<void()> &func);
template<class T, typename F>
void setOnTriggered(T *guard,
void addOnTriggered(T *guard,
F &&function,
Qt::ConnectionType connectionType = Qt::AutoConnection)
{
@@ -58,7 +58,7 @@ public:
}
template<class T, typename F>
void setOnToggled(T *guard,
void addOnToggled(T *guard,
F &&function,
Qt::ConnectionType connectionType = Qt::AutoConnection)
{

View File

@@ -423,19 +423,19 @@ void EditorManagerPrivate::init()
revertToSaved.setCommandAttribute(Command::CA_UpdateText);
revertToSaved.setCommandDescription(::Core::Tr::tr("Revert File to Saved"));
revertToSaved.addToContainer(Constants::M_FILE, Constants::G_FILE_SAVE);
revertToSaved.setOnTriggered(this, &EditorManager::revertToSaved);
revertToSaved.addOnTriggered(this, &EditorManager::revertToSaved);
// Save Action
ActionBuilder save(this, Constants::SAVE);
save.setContext(editManagerContext);
save.bindContextAction(&m_saveAction);
save.setOnTriggered(this, [] { EditorManager::saveDocument(); });
save.addOnTriggered(this, [] { EditorManager::saveDocument(); });
// Save As Action
ActionBuilder saveAs(this, Constants::SAVEAS);
saveAs.setContext(editManagerContext);
saveAs.bindContextAction(&m_saveAsAction);
saveAs.setOnTriggered(this, &EditorManager::saveDocumentAs);
saveAs.addOnTriggered(this, &EditorManager::saveDocumentAs);
// Window Menu
ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW);
@@ -453,7 +453,7 @@ void EditorManagerPrivate::init()
closeCurrentEditor.setCommandAttribute(Command::CA_UpdateText);
closeCurrentEditor.setCommandDescription(m_closeCurrentEditorAction->text());
closeCurrentEditor.addToContainer(Constants::M_FILE, Constants::G_FILE_CLOSE);
closeCurrentEditor.setOnTriggered(this, &EditorManager::slotCloseCurrentEditorOrDocument);
closeCurrentEditor.addOnTriggered(this, &EditorManager::slotCloseCurrentEditorOrDocument);
if (HostOsInfo::isWindowsHost()) {
// workaround for QTCREATORBUG-72
@@ -461,7 +461,7 @@ void EditorManagerPrivate::init()
workaround.setContext(editManagerContext);
workaround.setDefaultKeySequence(::Core::Tr::tr("Ctrl+F4"));
workaround.setCommandDescription(::Core::Tr::tr("Close"));
workaround.setOnTriggered(this, &EditorManager::slotCloseCurrentEditorOrDocument);
workaround.addOnTriggered(this, &EditorManager::slotCloseCurrentEditorOrDocument);
}
// Close All Action
@@ -472,7 +472,7 @@ void EditorManagerPrivate::init()
closeAll.bindContextAction(&m_closeAllEditorsAction);
closeAll.setDefaultKeySequence(::Core::Tr::tr("Ctrl+Shift+W"));
closeAll.addToContainer(Constants::M_FILE, Constants::G_FILE_CLOSE);
closeAll.setOnTriggered(this, &EditorManager::closeAllDocuments);
closeAll.addOnTriggered(this, &EditorManager::closeAllDocuments);
// Close All Others Action
ActionBuilder closeOthers(this, Constants::CLOSEOTHERS);
@@ -482,7 +482,7 @@ void EditorManagerPrivate::init()
closeOthers.setScriptable(true);
closeOthers.addToContainer(Constants::M_FILE, Constants::G_FILE_CLOSE);
closeOthers.setCommandAttribute(Command::CA_UpdateText);
closeOthers.setOnTriggered(this, [] { EditorManager::closeOtherDocuments(); });
closeOthers.addOnTriggered(this, [] { EditorManager::closeOtherDocuments(); });
// Close All Others Except Visible Action
ActionBuilder closeAllExceptVisible(this, Constants::CLOSEALLEXCEPTVISIBLE);
@@ -491,13 +491,13 @@ void EditorManagerPrivate::init()
closeAllExceptVisible.setContext(editManagerContext);
closeAllExceptVisible.setScriptable(true);
closeAllExceptVisible.addToContainer(Constants::M_FILE, Constants::G_FILE_CLOSE);
closeAllExceptVisible.setOnTriggered(this, &EditorManagerPrivate::closeAllEditorsExceptVisible);
closeAllExceptVisible.addOnTriggered(this, &EditorManagerPrivate::closeAllEditorsExceptVisible);
ActionBuilder openGraphicalShell(this, Constants::SHOWINGRAPHICALSHELL);
openGraphicalShell.setText(FileUtils::msgGraphicalShellAction());
openGraphicalShell.bindContextAction(&m_openGraphicalShellAction);
openGraphicalShell.setContext(editManagerContext);
openGraphicalShell.setOnTriggered(this, [] {
openGraphicalShell.addOnTriggered(this, [] {
if (!EditorManager::currentDocument())
return;
const FilePath fp = EditorManager::currentDocument()->filePath();
@@ -509,7 +509,7 @@ void EditorManagerPrivate::init()
showInFileSystem.setText(FileUtils::msgFileSystemAction());
showInFileSystem.setContext(editManagerContext);
showInFileSystem.bindContextAction(&m_showInFileSystemViewAction);
showInFileSystem.setOnTriggered(this, [] {
showInFileSystem.addOnTriggered(this, [] {
if (!EditorManager::currentDocument())
return;
const FilePath fp = EditorManager::currentDocument()->filePath();
@@ -568,7 +568,7 @@ void EditorManagerPrivate::init()
gotoPrevInHistory.setContext(editDesignContext);
gotoPrevInHistory.setDefaultKeySequence(::Core::Tr::tr("Alt+Tab"), ::Core::Tr::tr("Ctrl+Tab"));
gotoPrevInHistory.addToContainer(Constants::M_WINDOW, Constants::G_WINDOW_NAVIGATE);
gotoPrevInHistory.setOnTriggered(this, &EditorManagerPrivate::gotoPreviousDocHistory);
gotoPrevInHistory.addOnTriggered(this, &EditorManagerPrivate::gotoPreviousDocHistory);
// Goto Next In History Action
ActionBuilder gotoNextInHistory(this, Constants::GOTONEXTINHISTORY);
@@ -577,7 +577,7 @@ void EditorManagerPrivate::init()
gotoNextInHistory.setContext(editDesignContext);
gotoNextInHistory.setDefaultKeySequence(::Core::Tr::tr("Alt+Shift+Tab"), ::Core::Tr::tr("Ctrl+Shift+Tab"));
gotoNextInHistory.addToContainer(Constants::M_WINDOW, Constants::G_WINDOW_NAVIGATE);
gotoNextInHistory.setOnTriggered(this, &EditorManagerPrivate::gotoNextDocHistory);
gotoNextInHistory.addOnTriggered(this, &EditorManagerPrivate::gotoNextDocHistory);
// Go back in navigation history
ActionBuilder goBack(this, Constants::GO_BACK);
@@ -587,7 +587,7 @@ void EditorManagerPrivate::init()
goBack.setContext(editDesignContext);
goBack.setDefaultKeySequence(::Core::Tr::tr("Ctrl+Alt+Left"), ::Core::Tr::tr("Alt+Left"));
goBack.addToContainer(Constants::M_WINDOW, Constants::G_WINDOW_NAVIGATE);
goBack.setOnTriggered(this, &EditorManager::goBackInNavigationHistory);
goBack.addOnTriggered(this, &EditorManager::goBackInNavigationHistory);
// Go forward in navigation history
ActionBuilder goForward(this, Constants::GO_FORWARD);
@@ -597,7 +597,7 @@ void EditorManagerPrivate::init()
goForward.setContext(editDesignContext);
goForward.setDefaultKeySequence(::Core::Tr::tr("Ctrl+Alt+Right"), ::Core::Tr::tr("Alt+Right"));
goForward.addToContainer(Constants::M_WINDOW, Constants::G_WINDOW_NAVIGATE);
goForward.setOnTriggered(this, &EditorManager::goForwardInNavigationHistory);
goForward.addOnTriggered(this, &EditorManager::goForwardInNavigationHistory);
// Go to last edit
ActionBuilder gotoLastEdit(this, Constants::GOTOLASTEDIT);
@@ -605,7 +605,7 @@ void EditorManagerPrivate::init()
gotoLastEdit.bindContextAction(&m_gotoLastEditAction);
gotoLastEdit.setContext(editDesignContext);
gotoLastEdit.addToContainer(Constants::M_WINDOW, Constants::G_WINDOW_NAVIGATE);
gotoLastEdit.setOnTriggered(this, &EditorManagerPrivate::gotoLastEditLocation);
gotoLastEdit.addOnTriggered(this, &EditorManagerPrivate::gotoLastEditLocation);
ActionBuilder split(this, Constants::SPLIT);
split.setText(::Core::Tr::tr("Split"));
@@ -614,7 +614,7 @@ void EditorManagerPrivate::init()
split.setContext(editManagerContext);
split.setDefaultKeySequence(::Core::Tr::tr("Meta+E,2"), ::Core::Tr::tr("Ctrl+E,2"));
split.addToContainer(Constants::M_WINDOW, Constants::G_WINDOW_SPLIT);
split.setOnTriggered(this, [this] { this->split(Qt::Vertical); });
split.addOnTriggered(this, [this] { this->split(Qt::Vertical); });
ActionBuilder splitSideBySide(this, Constants::SPLIT_SIDE_BY_SIDE);
splitSideBySide.setIcon(Utils::Icons::SPLIT_VERTICAL.icon());
@@ -623,7 +623,7 @@ void EditorManagerPrivate::init()
splitSideBySide.setContext(editManagerContext);
splitSideBySide.setDefaultKeySequence(::Core::Tr::tr("Meta+E,3"), Core::Tr::tr("Ctrl+E,3"));
splitSideBySide.addToContainer(Constants::M_WINDOW, Constants::G_WINDOW_SPLIT);
splitSideBySide.setOnTriggered(this, &EditorManager::splitSideBySide);
splitSideBySide.addOnTriggered(this, &EditorManager::splitSideBySide);
ActionBuilder splitNewWindow(this, Constants::SPLIT_NEW_WINDOW);
splitNewWindow.setText(::Core::Tr::tr("Open in New Window"));
@@ -631,7 +631,7 @@ void EditorManagerPrivate::init()
splitNewWindow.setContext(editManagerContext);
splitNewWindow.setDefaultKeySequence(::Core::Tr::tr("Meta+E,4"), ::Core::Tr::tr("Ctrl+E,4"));
splitNewWindow.addToContainer(Constants::M_WINDOW, Constants::G_WINDOW_SPLIT);
splitNewWindow.setOnTriggered(this, [this] { this->splitNewWindow(currentEditorView()); });
splitNewWindow.addOnTriggered(this, [this] { this->splitNewWindow(currentEditorView()); });
ActionBuilder removeCurrentSplit(this, Constants::REMOVE_CURRENT_SPLIT);
removeCurrentSplit.setText(::Core::Tr::tr("Remove Current Split"));
@@ -639,7 +639,7 @@ void EditorManagerPrivate::init()
removeCurrentSplit.setContext(editManagerContext);
removeCurrentSplit.setDefaultKeySequence(::Core::Tr::tr("Meta+E,0"), ::Core::Tr::tr("Ctrl+E,0"));
removeCurrentSplit.addToContainer(Constants::M_WINDOW, Constants::G_WINDOW_SPLIT);
removeCurrentSplit.setOnTriggered(this, &EditorManagerPrivate::removeCurrentSplit);
removeCurrentSplit.addOnTriggered(this, &EditorManagerPrivate::removeCurrentSplit);
ActionBuilder removeAllSplits(this, Constants::REMOVE_ALL_SPLITS);
removeAllSplits.setText(::Core::Tr::tr("Remove All Splits"));
@@ -647,7 +647,7 @@ void EditorManagerPrivate::init()
removeAllSplits.setContext(editManagerContext);
removeAllSplits.setDefaultKeySequence(::Core::Tr::tr("Meta+E,1"), ::Core::Tr::tr("Ctrl+E,1"));
removeAllSplits.addToContainer(Constants::M_WINDOW, Constants::G_WINDOW_SPLIT);
removeAllSplits.setOnTriggered(this, &EditorManagerPrivate::removeAllSplits);
removeAllSplits.addOnTriggered(this, &EditorManagerPrivate::removeAllSplits);
ActionBuilder gotoPreviousSplit(this, Constants::GOTO_PREV_SPLIT);
gotoPreviousSplit.setText(::Core::Tr::tr("Go to Previous Split or Window"));
@@ -655,7 +655,7 @@ void EditorManagerPrivate::init()
gotoPreviousSplit.setContext(editManagerContext);
gotoPreviousSplit.setDefaultKeySequence(::Core::Tr::tr("Meta+E,i"), ::Core::Tr::tr("Ctrl+E,i"));
gotoPreviousSplit.addToContainer(Constants::M_WINDOW, Constants::G_WINDOW_SPLIT);
gotoPreviousSplit.setOnTriggered(this, &EditorManagerPrivate::gotoPreviousSplit);
gotoPreviousSplit.addOnTriggered(this, &EditorManagerPrivate::gotoPreviousSplit);
ActionBuilder gotoNextSplit(this, Constants::GOTO_NEXT_SPLIT);
gotoNextSplit.setText(::Core::Tr::tr("Go to Next Split or Window"));
@@ -663,7 +663,7 @@ void EditorManagerPrivate::init()
gotoNextSplit.setContext(editManagerContext);
gotoNextSplit.setDefaultKeySequence(QKeySequence(useMacShortcuts ? ::Core::Tr::tr("Meta+E,o") : ::Core::Tr::tr("Ctrl+E,o")));
gotoNextSplit.addToContainer(Constants::M_WINDOW, Constants::G_WINDOW_SPLIT);
gotoNextSplit.setOnTriggered(this, &EditorManagerPrivate::gotoNextSplit);
gotoNextSplit.addOnTriggered(this, &EditorManagerPrivate::gotoNextSplit);
ActionContainer *medit = ActionManager::actionContainer(Constants::M_EDIT);
ActionContainer *advancedMenu = ActionManager::createMenu(Constants::M_EDIT_ADVANCED);

View File

@@ -280,7 +280,7 @@ void FindPrivate::setupMenu()
openFindDialog.bindContextAction(&m_openFindDialog);
openFindDialog.setDefaultKeySequence(Tr::tr("Ctrl+Shift+F"));
openFindDialog.addToContainer(Constants::M_FIND_ADVANCED);
openFindDialog.setOnTriggered(this, [] { Find::openFindDialog(nullptr); });
openFindDialog.addOnTriggered(this, [] { Find::openFindDialog(nullptr); });
}
static QString filterActionName(const IFindFilter *filter)
@@ -304,7 +304,7 @@ void FindPrivate::setupFilterMenuItems()
findScope.setDefaultKeySequence(filter->defaultShortcut());
findScope.setCommandAttribute(Command::CA_UpdateText);
findScope.addToContainer(Constants::M_FIND_ADVANCED);
findScope.setOnTriggered(this, [filter] { Find::openFindDialog(filter); });
findScope.addOnTriggered(this, [filter] { Find::openFindDialog(filter); });
QAction *findScopeAction = findScope.contextAction();
connect(filter, &IFindFilter::enabledChanged, this, [filter, findScopeAction] {

View File

@@ -250,7 +250,7 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
ActionBuilder goToCurrentFindAction(this, Constants::S_RETURNTOEDITOR);
goToCurrentFindAction.setContext(findcontext);
goToCurrentFindAction.bindContextAction(&m_goToCurrentFindAction);
goToCurrentFindAction.setOnTriggered(this, [this] { setFocusToCurrentFindSupport(); });
goToCurrentFindAction.addOnTriggered(this, [this] { setFocusToCurrentFindSupport(); });
ActionBuilder findInDocumentAction(this, Constants::FIND_IN_DOCUMENT);
findInDocumentAction.setText(Tr::tr("Find/Replace"));
@@ -258,14 +258,14 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
findInDocumentAction.bindContextAction(&m_findInDocumentAction);
findInDocumentAction.setDefaultKeySequence(QKeySequence::Find);
findInDocumentAction.addToContainer(Constants::M_FIND, Constants::G_FIND_CURRENTDOCUMENT);
findInDocumentAction.setOnTriggered(this, [this] { openFind(); });
findInDocumentAction.addOnTriggered(this, [this] { openFind(); });
// Pressing the find shortcut while focus is in the tool bar should not change the search text,
// so register a different find action for the tool bar
ActionBuilder localFindAction(this, Constants::FIND_IN_DOCUMENT);
localFindAction.setText(m_findInDocumentAction->text());
localFindAction.setContext(findcontext);
localFindAction.setOnTriggered(this, [this] {
localFindAction.addOnTriggered(this, [this] {
openFindToolBar(FindToolBar::OpenFlags(UpdateAll & ~UpdateFindText));
});
@@ -275,7 +275,7 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
enterFindStringAction.setDefaultKeySequence(Tr::tr("Ctrl+E"));
enterFindStringAction.addToContainer(Constants::M_FIND, Constants::G_FIND_ACTIONS);
enterFindStringAction.bindContextAction(&m_enterFindStringAction);
enterFindStringAction.setOnTriggered(this, [this] { putSelectionToFindClipboard(); });
enterFindStringAction.addOnTriggered(this, [this] { putSelectionToFindClipboard(); });
connect(QApplication::clipboard(), &QClipboard::findBufferChanged, this, &FindToolBar::updateFromFindClipboard);
}
@@ -284,14 +284,14 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
findNextAction.bindContextAction(&m_findNextAction);
findNextAction.setDefaultKeySequence(QKeySequence::FindNext);
findNextAction.addToContainer(Constants::M_FIND, Constants::G_FIND_ACTIONS);
findNextAction.setOnTriggered(this, [this] { invokeGlobalFindNext(); });
findNextAction.addOnTriggered(this, [this] { invokeGlobalFindNext(); });
ActionBuilder localFindNextAction(this, Constants::FIND_NEXT);
localFindNextAction.setText(m_findNextAction->text());
localFindNextAction.bindContextAction(&m_localFindNextAction);
localFindNextAction.setContext(findcontext);
localFindNextAction.augmentActionWithShortcutToolTip();
localFindNextAction.setOnTriggered(this, [this] { invokeFindNext(); });
localFindNextAction.addOnTriggered(this, [this] { invokeFindNext(); });
m_findNextButton->setDefaultAction(m_localFindNextAction);
ActionBuilder findPreviousAction(this, Constants::FIND_PREVIOUS);
@@ -299,14 +299,14 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
findPreviousAction.bindContextAction(&m_findPreviousAction);
findPreviousAction.setDefaultKeySequence(QKeySequence::FindPrevious);
findPreviousAction.addToContainer(Constants::M_FIND, Constants::G_FIND_ACTIONS);
findPreviousAction.setOnTriggered(this, [this] { invokeGlobalFindPrevious(); });
findPreviousAction.addOnTriggered(this, [this] { invokeGlobalFindPrevious(); });
ActionBuilder localFindPreviousAction(this, Constants::FIND_PREVIOUS);
localFindPreviousAction.setText(m_findPreviousAction->text());
localFindPreviousAction.bindContextAction(&m_localFindPreviousAction);
localFindPreviousAction.setContext(findcontext);
localFindPreviousAction.augmentActionWithShortcutToolTip();
localFindPreviousAction.setOnTriggered(this, [this] { invokeFindPrevious(); });
localFindPreviousAction.addOnTriggered(this, [this] { invokeFindPrevious(); });
m_findPreviousButton->setDefaultAction(m_localFindPreviousAction);
ActionBuilder findNextSelectedAction(this, Constants::FIND_NEXT_SELECTED);
@@ -314,28 +314,28 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
findNextSelectedAction.bindContextAction(&m_findNextSelectedAction);
findNextSelectedAction.setDefaultKeySequence(Tr::tr("Ctrl+F3"));
findNextSelectedAction.addToContainer(Constants::M_FIND, Constants::G_FIND_ACTIONS);
findNextSelectedAction.setOnTriggered(this, [this] { findNextSelected(); });
findNextSelectedAction.addOnTriggered(this, [this] { findNextSelected(); });
ActionBuilder findPreviousSelectedAction(this, Constants::FIND_PREV_SELECTED);
findPreviousSelectedAction.setText(Tr::tr("Find Previous (Selected)"));
findPreviousSelectedAction.bindContextAction(&m_findPreviousSelectedAction);
findPreviousSelectedAction.setDefaultKeySequence(Tr::tr("Ctrl+Shift+F3"));
findPreviousSelectedAction.addToContainer(Constants::M_FIND, Constants::G_FIND_ACTIONS);
findPreviousSelectedAction.setOnTriggered(this, [this] { findPreviousSelected(); });
findPreviousSelectedAction.addOnTriggered(this, [this] { findPreviousSelected(); });
ActionBuilder selectAllAction(this, Constants::FIND_SELECT_ALL);
selectAllAction.setText(Tr::tr("Select All"));
selectAllAction.bindContextAction(&m_selectAllAction);
selectAllAction.setDefaultKeySequence(Tr::tr("Ctrl+Alt+Return"));
selectAllAction.addToContainer(Constants::M_FIND, Constants::G_FIND_ACTIONS);
selectAllAction.setOnTriggered(this, [this] { selectAll(); });
selectAllAction.addOnTriggered(this, [this] { selectAll(); });
ActionBuilder localSelectAllAction(this, Constants::FIND_SELECT_ALL);
localSelectAllAction.setText(m_selectAllAction->text());
localSelectAllAction.setContext(findcontext);
localSelectAllAction.bindContextAction(&m_localSelectAllAction);
localSelectAllAction.augmentActionWithShortcutToolTip();
localSelectAllAction.setOnTriggered(this, [this] { selectAll(); });
localSelectAllAction.addOnTriggered(this, [this] { selectAll(); });
m_selectAllButton->setDefaultAction(m_localSelectAllAction);
ActionBuilder replaceAction(this, Constants::REPLACE);
@@ -343,14 +343,14 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
replaceAction.bindContextAction(&m_replaceAction);
replaceAction.setDefaultKeySequence({});
replaceAction.addToContainer(Constants::M_FIND, Constants::G_FIND_ACTIONS);
replaceAction.setOnTriggered(this, [this] { invokeGlobalReplace(); });
replaceAction.addOnTriggered(this, [this] { invokeGlobalReplace(); });
ActionBuilder localReplaceAction(this, Constants::REPLACE);
localReplaceAction.setText(m_replaceAction->text());
localReplaceAction.setContext(findcontext);
localReplaceAction.bindContextAction(&m_localReplaceAction);
localReplaceAction.augmentActionWithShortcutToolTip();
localReplaceAction.setOnTriggered(this, [this] { invokeReplace(); });
localReplaceAction.addOnTriggered(this, [this] { invokeReplace(); });
m_replaceButton->setDefaultAction(m_localReplaceAction);
ActionBuilder replaceNextAction(this, Constants::REPLACE_NEXT);
@@ -358,7 +358,7 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
replaceNextAction.bindContextAction(&m_replaceNextAction);
replaceNextAction.setDefaultKeySequence(Tr::tr("Ctrl+="));
replaceNextAction.addToContainer(Constants::M_FIND, Constants::G_FIND_ACTIONS);
replaceNextAction.setOnTriggered(this, [this] { invokeGlobalReplaceNext(); });
replaceNextAction.addOnTriggered(this, [this] { invokeGlobalReplaceNext(); });
ActionBuilder localReplaceNextAction(this, Constants::REPLACE_NEXT);
localReplaceNextAction.setText(m_replaceNextAction->text());
@@ -366,35 +366,35 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
localReplaceNextAction.setContext(findcontext);
localReplaceNextAction.bindContextAction(&m_localReplaceNextAction);
localReplaceNextAction.augmentActionWithShortcutToolTip();
localReplaceNextAction.setOnTriggered(this, [this] { invokeReplaceNext(); });
localReplaceNextAction.addOnTriggered(this, [this] { invokeReplaceNext(); });
m_replaceNextButton->setDefaultAction(m_localReplaceNextAction);
ActionBuilder replacePreviousAction(this, Constants::REPLACE_PREVIOUS);
replacePreviousAction.setText(Tr::tr("Replace && Find Previous"));
replacePreviousAction.bindContextAction(&m_replacePreviousAction);
replacePreviousAction.addToContainer(Constants::M_FIND, Constants::G_FIND_ACTIONS);
replacePreviousAction.setOnTriggered(this, [this] { invokeGlobalReplacePrevious(); });
replacePreviousAction.addOnTriggered(this, [this] { invokeGlobalReplacePrevious(); });
ActionBuilder localReplacePreviousAction(this, Constants::REPLACE_PREVIOUS);
localReplacePreviousAction.setText(m_replacePreviousAction->text());
localReplacePreviousAction.setContext(findcontext);
localReplacePreviousAction.bindContextAction(&m_localReplacePreviousAction);
localReplacePreviousAction.augmentActionWithShortcutToolTip();
localReplacePreviousAction.setOnTriggered(this, [this] { invokeReplacePrevious(); });
localReplacePreviousAction.addOnTriggered(this, [this] { invokeReplacePrevious(); });
ActionBuilder replaceAllAction(this, Constants::REPLACE_ALL);
replaceAllAction.setText(Tr::tr("Replace All"));
replaceAllAction.bindContextAction(&m_replaceAllAction);
replaceAllAction.setDefaultKeySequence(Tr::tr("Ctrl+Alt+Return"));
replaceAllAction.addToContainer(Constants::M_FIND, Constants::G_FIND_ACTIONS);
replaceAllAction.setOnTriggered(this, [this] { invokeGlobalReplaceAll(); });
replaceAllAction.addOnTriggered(this, [this] { invokeGlobalReplaceAll(); });
ActionBuilder localReplaceAllAction(this, Constants::REPLACE_ALL);
localReplaceAllAction.setText(m_replaceAllAction->text());
localReplaceAllAction.setContext(findcontext);
localReplaceAllAction.bindContextAction(&m_localReplaceAllAction);
localReplaceAllAction.augmentActionWithShortcutToolTip();
localReplaceAllAction.setOnTriggered(this, [this] { invokeReplaceAll(); });
localReplaceAllAction.addOnTriggered(this, [this] { invokeReplaceAll(); });
m_replaceAllButton->setDefaultAction(m_localReplaceAllAction);
ActionBuilder caseSensitiveAction(this, Constants::CASE_SENSITIVE);
@@ -404,7 +404,7 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
caseSensitiveAction.setCheckable(true);
caseSensitiveAction.setChecked(false);
caseSensitiveAction.addToContainer(Constants::M_FIND, Constants::G_FIND_FLAGS);
caseSensitiveAction.setOnToggled(this, [this](bool on) { setCaseSensitive(on); });
caseSensitiveAction.addOnToggled(this, [this](bool on) { setCaseSensitive(on); });
ActionBuilder wholeWordAction(this, Constants::WHOLE_WORDS);
wholeWordAction.setText(Tr::tr("Whole Words Only"));
@@ -413,7 +413,7 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
wholeWordAction.setCheckable(true);
wholeWordAction.setChecked(false);
wholeWordAction.addToContainer(Constants::M_FIND, Constants::G_FIND_FLAGS);
wholeWordAction.setOnToggled(this, [this](bool on) { setWholeWord(on); });
wholeWordAction.addOnToggled(this, [this](bool on) { setWholeWord(on); });
ActionBuilder regularExpressionAction(this, Constants::REGULAR_EXPRESSIONS);
regularExpressionAction.setText(Tr::tr("Use Regular Expressions"));
@@ -422,7 +422,7 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
regularExpressionAction.setCheckable(true);
regularExpressionAction.setChecked(false);
regularExpressionAction.addToContainer(Constants::M_FIND, Constants::G_FIND_FLAGS);
regularExpressionAction.setOnToggled(this, [this](bool on) { setRegularExpressions(on); });
regularExpressionAction.addOnToggled(this, [this](bool on) { setRegularExpressions(on); });
ActionBuilder preserveCaseAction(this, Constants::PRESERVE_CASE);
preserveCaseAction.setText(Tr::tr("Preserve Case when Replacing"));
@@ -431,7 +431,7 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
preserveCaseAction.setCheckable(true);
preserveCaseAction.setChecked(false);
preserveCaseAction.addToContainer(Constants::M_FIND, Constants::G_FIND_FLAGS);
preserveCaseAction.setOnToggled(this, [this](bool on) { setPreserveCase(on); });
preserveCaseAction.addOnToggled(this, [this](bool on) { setPreserveCase(on); });
connect(m_currentDocumentFind, &CurrentDocumentFind::candidateChanged,
this, &FindToolBar::adaptToCandidate);

View File

@@ -1621,7 +1621,7 @@ void ICorePrivate::registerDefaultActions()
ActionBuilder focusToEditor(this, Constants::S_RETURNTOEDITOR);
focusToEditor.setText(Tr::tr("Return to Editor"));
focusToEditor.setDefaultKeySequence(QKeySequence(Qt::Key_Escape));
focusToEditor.setOnTriggered(this, [] { setFocusToEditor(); });
focusToEditor.addOnTriggered(this, [] { setFocusToEditor(); });
// New Project Action
ActionBuilder newProjectAction(this, Constants::NEW);
@@ -1629,7 +1629,7 @@ void ICorePrivate::registerDefaultActions()
newProjectAction.setIcon(Icon::fromTheme("document-new"));
newProjectAction.setDefaultKeySequence(QKeySequence("Ctrl+Shift+N"));
newProjectAction.addToContainer(Constants::M_FILE, Constants::G_FILE_NEW);
newProjectAction.setOnTriggered(this, [] {
newProjectAction.addOnTriggered(this, [] {
if (!ICore::isNewItemDialogRunning()) {
ICore::showNewItemDialog(
Tr::tr("New Project", "Title of dialog"),
@@ -1648,7 +1648,7 @@ void ICorePrivate::registerDefaultActions()
newFileAction.setIcon(Icon::fromTheme("document-new"));
newFileAction.setDefaultKeySequence(QKeySequence::New);
newFileAction.addToContainer(Constants::M_FILE, Constants::G_FILE_NEW);
newFileAction.setOnTriggered(this, [] {
newFileAction.addOnTriggered(this, [] {
if (!ICore::isNewItemDialogRunning()) {
ICore::showNewItemDialog(
Tr::tr("New File", "Title of dialog"),
@@ -1667,20 +1667,20 @@ void ICorePrivate::registerDefaultActions()
openAction.setIcon(Icon::fromTheme("document-open"));
openAction.setDefaultKeySequence(QKeySequence::Open);
openAction.addToContainer(Constants::M_FILE, Constants::G_FILE_OPEN);
openAction.setOnTriggered(this, [] { openFile(); });
openAction.addOnTriggered(this, [] { openFile(); });
// Open With Action
ActionBuilder openWithAction(this, Constants::OPEN_WITH);
openWithAction.setText(Tr::tr("Open File &With..."));
openWithAction.addToContainer(Constants::M_FILE, Constants::G_FILE_OPEN);
openWithAction.setOnTriggered(this, &ICore::openFileWith);
openWithAction.addOnTriggered(this, &ICore::openFileWith);
if (FSEngine::isAvailable()) {
// Open From Device Action
ActionBuilder openFromDeviceAction(this, Constants::OPEN_FROM_DEVICE);
openFromDeviceAction.setText(Tr::tr("Open From Device..."));
openFromDeviceAction.addToContainer(Constants::M_FILE, Constants::G_FILE_OPEN);
openFromDeviceAction.setOnTriggered(this, [this] { openFileFromDevice(); });
openFromDeviceAction.addOnTriggered(this, [this] { openFileFromDevice(); });
}
// File->Recent Files Menu
@@ -1727,7 +1727,7 @@ void ICorePrivate::registerDefaultActions()
exitAction.setMenuRole(QAction::QuitRole);
exitAction.setDefaultKeySequence(Tr::tr("Ctrl+Q"));
exitAction.addToContainer(Constants::M_FILE, Constants::G_FILE_OTHER);
exitAction.setOnTriggered(this, &ICore::exit);
exitAction.addOnTriggered(this, &ICore::exit);
// Undo Action
ActionBuilder undoAction(this, Constants::UNDO);
@@ -1822,7 +1822,7 @@ void ICorePrivate::registerDefaultActions()
ActionBuilder loggerAction(this, Constants::LOGGER);
loggerAction.setText(Tr::tr("Show Logs..."));
loggerAction.addToContainer(Constants::M_TOOLS_DEBUG);
loggerAction.setOnTriggered(this, &LoggingViewer::showLoggingView);
loggerAction.addOnTriggered(this, &LoggingViewer::showLoggingView);
// Options Action
medit->appendGroup(Constants::G_EDIT_PREFERENCES);
@@ -1833,7 +1833,7 @@ void ICorePrivate::registerDefaultActions()
optionsAction.setMenuRole(QAction::PreferencesRole);
optionsAction.setDefaultKeySequence(QKeySequence::Preferences);
optionsAction.addToContainer(Constants::M_EDIT, Constants::G_EDIT_PREFERENCES);
optionsAction.setOnTriggered(this, [] { ICore::showOptionsDialog(Id()); });
optionsAction.addOnTriggered(this, [] { ICore::showOptionsDialog(Id()); });
mwindow->addSeparator(Constants::G_WINDOW_LIST);
@@ -1882,7 +1882,7 @@ void ICorePrivate::registerDefaultActions()
toggleLeftSideBarAction.setCommandAttribute(Command::CA_UpdateText);
toggleLeftSideBarAction.setDefaultKeySequence(Tr::tr("Ctrl+0"), Tr::tr("Alt+0"));
toggleLeftSideBarAction.addToContainer(Constants::M_VIEW, Constants::G_VIEW_VIEWS);
toggleLeftSideBarAction.setOnTriggered(this,
toggleLeftSideBarAction.addOnTriggered(this,
[this](bool visible) { setSidebarVisible(visible, Side::Left); });
m_toggleLeftSideBarAction = toggleLeftSideBarAction.contextAction();
@@ -1899,7 +1899,7 @@ void ICorePrivate::registerDefaultActions()
toggleRightSideBarAction.setDefaultKeySequence(Tr::tr("Ctrl+Shift+0"), Tr::tr("Alt+Shift+0"));
toggleRightSideBarAction.addToContainer(Constants::M_VIEW, Constants::G_VIEW_VIEWS);
toggleRightSideBarAction.setEnabled(false);
toggleRightSideBarAction.setOnTriggered(this,
toggleRightSideBarAction.addOnTriggered(this,
[this](bool visible) { setSidebarVisible(visible, Side::Right); });
m_toggleRightSideBarAction = toggleRightSideBarAction.contextAction();
@@ -1948,7 +1948,7 @@ void ICorePrivate::registerDefaultActions()
aboutIdeAction.setMenuRole(QAction::AboutRole);
aboutIdeAction.addToContainer(Constants::M_HELP, Constants::G_HELP_ABOUT);
aboutIdeAction.setEnabled(true);
aboutIdeAction.setOnTriggered(this, [this] { aboutQtCreator(); });
aboutIdeAction.addOnTriggered(this, [this] { aboutQtCreator(); });
// About Plugins Action
ActionBuilder aboutPluginsAction(this, Constants::ABOUT_PLUGINS);
@@ -1956,7 +1956,7 @@ void ICorePrivate::registerDefaultActions()
aboutPluginsAction.setMenuRole(QAction::ApplicationSpecificRole);
aboutPluginsAction.addToContainer(Constants::M_HELP, Constants::G_HELP_ABOUT);
aboutPluginsAction.setEnabled(true);
aboutPluginsAction.setOnTriggered(this, [this] { aboutPlugins(); });
aboutPluginsAction.addOnTriggered(this, [this] { aboutPlugins(); });
// Change Log Action
ActionBuilder changeLogAction(this, Constants::CHANGE_LOG);
@@ -1964,14 +1964,14 @@ void ICorePrivate::registerDefaultActions()
changeLogAction.setMenuRole(QAction::ApplicationSpecificRole);
changeLogAction.addToContainer(Constants::M_HELP, Constants::G_HELP_ABOUT);
changeLogAction.setEnabled(true);
changeLogAction.setOnTriggered(this, [this] { changeLog(); });
changeLogAction.addOnTriggered(this, [this] { changeLog(); });
// Contact
ActionBuilder contactAction(this, "QtCreator.Contact");
contactAction.setText(Tr::tr("Contact..."));
contactAction.addToContainer(Constants::M_HELP, Constants::G_HELP_ABOUT);
contactAction.setEnabled(true);
contactAction.setOnTriggered(this, [this] { contact(); });
contactAction.addOnTriggered(this, [this] { contact(); });
// About sep
if (!HostOsInfo::isMacHost()) { // doesn't have the "About" actions in the Help menu

View File

@@ -179,17 +179,17 @@ void IOutputPane::setupFilterUi(const Key &historyKey)
ActionBuilder filterRegexpAction(this, filterRegexpActionId());
filterRegexpAction.setText(Tr::tr("Use Regular Expressions"));
filterRegexpAction.setCheckable(true);
filterRegexpAction.setOnToggled(this, &IOutputPane::setRegularExpressions);
filterRegexpAction.addOnToggled(this, &IOutputPane::setRegularExpressions);
ActionBuilder filterCaseSensitiveAction(this, filterCaseSensitivityActionId());
filterCaseSensitiveAction.setText(Tr::tr("Case Sensitive"));
filterCaseSensitiveAction.setCheckable(true);
filterCaseSensitiveAction.setOnToggled(this, &IOutputPane::setCaseSensitive);
filterCaseSensitiveAction.addOnToggled(this, &IOutputPane::setCaseSensitive);
ActionBuilder invertFilterAction(this, filterInvertedActionId());
invertFilterAction.setText(Tr::tr("Show Non-matching Lines"));
invertFilterAction.setCheckable(true);
invertFilterAction.setOnToggled(this, [this, action=invertFilterAction.contextAction()] {
invertFilterAction.addOnToggled(this, [this, action=invertFilterAction.contextAction()] {
m_invertFilter = action->isChecked();
updateFilter();
});

View File

@@ -712,7 +712,7 @@ void setupGenericProject(QObject *guard)
editAction.setText(Tr::tr("Edit Files..."));
editAction.setCommandAttribute(Command::CA_Hide);
editAction.addToContainer(PEC::M_PROJECTCONTEXT, PEC::G_PROJECT_FILES);
editAction.setOnTriggered([] {
editAction.addOnTriggered([] {
if (auto genericProject = qobject_cast<GenericProject *>(ProjectTree::currentProject()))
genericProject->editFilesTriggered();
});
@@ -721,7 +721,7 @@ void setupGenericProject(QObject *guard)
removeDirAction.setContext(PEC::C_PROJECT_TREE);
removeDirAction.setText(Tr::tr("Remove Directory"));
removeDirAction.addToContainer(PEC::M_FOLDERCONTEXT, PEC::G_FOLDER_OTHER);
removeDirAction.setOnTriggered([] {
removeDirAction.addOnTriggered([] {
const auto folderNode = ProjectTree::currentNode()->asFolderNode();
QTC_ASSERT(folderNode, return);
const auto project = qobject_cast<GenericProject *>(folderNode->getProject());

View File

@@ -58,7 +58,7 @@ void setupHaskellActions(QObject *guard)
{
ActionBuilder runGhci(guard, Haskell::Constants::A_RUN_GHCI);
runGhci.setText(Tr::tr("Run GHCi"));
runGhci.setOnTriggered(guard, [] {
runGhci.addOnTriggered(guard, [] {
if (IDocument *doc = EditorManager::currentDocument())
openGhci(doc->filePath());
});

View File

@@ -83,7 +83,7 @@ void HelloWorldPlugin::initialize()
Core::ActionBuilder hello(this, "HelloWorld.HelloWorldAction");
hello.setText(Tr::tr("Say \"&Hello World!\""));
hello.setContext(context);
hello.setOnTriggered(this, [this] { sayHelloWorld(); });
hello.addOnTriggered(this, [this] { sayHelloWorld(); });
// Add the Hello World action command to the menu
hello.addToContainer(menuId);

View File

@@ -217,12 +217,12 @@ HelpPluginPrivate::HelpPluginPrivate()
helpContents.setText(Tr::tr(Constants::SB_CONTENTS));
helpContents.setIcon(QIcon::fromTheme("help-contents"));
helpContents.addToContainer(Core::Constants::M_HELP, Core::Constants::G_HELP_HELP);
helpContents.setOnTriggered(this, &HelpPluginPrivate::activateContents);
helpContents.addOnTriggered(this, &HelpPluginPrivate::activateContents);
ActionBuilder helpIndex(this, "Help.IndexMenu");
helpIndex.setText(Tr::tr(Constants::SB_INDEX));
helpIndex.addToContainer(Core::Constants::M_HELP, Core::Constants::G_HELP_HELP);
helpIndex.setOnTriggered(this, &HelpPluginPrivate::activateIndex);
helpIndex.addOnTriggered(this, &HelpPluginPrivate::activateIndex);
ActionBuilder helpContext(this, Help::Constants::CONTEXT_HELP);
helpContext.setText(Tr::tr("Context Help"));
@@ -231,7 +231,7 @@ HelpPluginPrivate::HelpPluginPrivate()
helpContext.addToContainer(Core::Constants::M_HELP, Core::Constants::G_HELP_HELP);
helpContext.addToContainer(Core::Constants::TOUCH_BAR, Core::Constants::G_TOUCHBAR_HELP);
helpContext.setDefaultKeySequence(Qt::Key_F1);
helpContext.setOnTriggered(this, &HelpPluginPrivate::requestContextHelp);
helpContext.addOnTriggered(this, &HelpPluginPrivate::requestContextHelp);
ActionContainer *textEditorContextMenu = ActionManager::actionContainer(
TextEditor::Constants::M_STANDARDCONTEXTMENU);
@@ -245,7 +245,7 @@ HelpPluginPrivate::HelpPluginPrivate()
ActionBuilder techSupport(this, "Help.TechSupport");
techSupport.setText(Tr::tr("Technical Support..."));
techSupport.addToContainer(Core::Constants::M_HELP, Core::Constants::G_HELP_SUPPORT);
techSupport.setOnTriggered(this, [this] {
techSupport.addOnTriggered(this, [this] {
showHelpUrl(QUrl("qthelp://org.qt-project.qtcreator/doc/technical-support.html"),
Core::HelpManager::HelpModeAlways);
});
@@ -256,7 +256,7 @@ HelpPluginPrivate::HelpPluginPrivate()
ActionBuilder reportBug(this, "Help.ReportBug");
reportBug.setText(Tr::tr("Report Bug..."));
reportBug.addToContainer(Core::Constants::M_HELP, Core::Constants::G_HELP_SUPPORT);
reportBug.setOnTriggered(this, [isDesigner] {
reportBug.addOnTriggered(this, [isDesigner] {
const QUrl bugreportUrl = isDesigner ? QString("https://bugreports.qt.io/secure/CreateIssue.jspa?pid=11740") //QDS
: QString("https://bugreports.qt.io/secure/CreateIssue.jspa?pid=10512"); //QtC
QDesktopServices::openUrl(bugreportUrl);
@@ -265,7 +265,7 @@ HelpPluginPrivate::HelpPluginPrivate()
ActionBuilder systemInformation(this, "Help.SystemInformation");
systemInformation.setText(Tr::tr("System Information..."));
systemInformation.addToContainer(Core::Constants::M_HELP, Core::Constants::G_HELP_SUPPORT);
systemInformation.setOnTriggered(this, &HelpPluginPrivate::slotSystemInformation);
systemInformation.addOnTriggered(this, &HelpPluginPrivate::slotSystemInformation);
connect(ModeManager::instance(), &ModeManager::currentModeChanged,
this, &HelpPluginPrivate::modeChanged);

View File

@@ -444,7 +444,7 @@ void setupImageViewer(QObject *guard)
if (!key.isEmpty())
builder.setDefaultKeySequence(key);
builder.setOnTriggered(guard, [onTriggered] {
builder.addOnTriggered(guard, [onTriggered] {
if (auto iv = qobject_cast<ImageViewer *>(EditorManager::currentEditor()))
onTriggered(iv);
});

View File

@@ -48,7 +48,7 @@ void LanguageClientPlugin::initialize()
ActionBuilder inspectAction(this, "LanguageClient.InspectLanguageClients");
inspectAction.setText(Tr::tr("Inspect Language Clients..."));
inspectAction.addToContainer(Core::Constants::M_TOOLS_DEBUG);
inspectAction.setOnTriggered(this, &LanguageClientManager::showInspector);
inspectAction.addOnTriggered(this, &LanguageClientManager::showInspector);
}
void LanguageClientPlugin::extensionsInitialized()

View File

@@ -61,7 +61,7 @@ public:
startMacro.setContext(textContext);
startMacro.setDefaultKeySequence(Tr::tr("Ctrl+["), Tr::tr("Alt+["));
startMacro.addToContainer(Constants::M_TOOLS_MACRO);
startMacro.setOnTriggered(this, [this] { d->macroManager.startMacro(); });
startMacro.addOnTriggered(this, [this] { d->macroManager.startMacro(); });
ActionBuilder endMacro(this, Constants::END_MACRO);
endMacro.setText(Tr::tr("Stop Recording Macro"));
@@ -69,21 +69,21 @@ public:
endMacro.setEnabled(false);
endMacro.setDefaultKeySequence(Tr::tr("Ctrl+]"), Tr::tr("Alt+]"));
endMacro.addToContainer(Constants::M_TOOLS_MACRO);
endMacro.setOnTriggered(this, [this] { d->macroManager.endMacro(); });
endMacro.addOnTriggered(this, [this] { d->macroManager.endMacro(); });
ActionBuilder executeLastMacro(this, Constants::EXECUTE_LAST_MACRO);
executeLastMacro.setText(Tr::tr("Play Last Macro"));
executeLastMacro.setContext(textContext);
executeLastMacro.setDefaultKeySequence(Tr::tr("Meta+R"), Tr::tr("Alt+R"));
executeLastMacro.addToContainer(Constants::M_TOOLS_MACRO);
executeLastMacro.setOnTriggered(this, [this] { d->macroManager.executeLastMacro(); });
executeLastMacro.addOnTriggered(this, [this] { d->macroManager.executeLastMacro(); });
ActionBuilder saveLastMacro(this, Constants::SAVE_LAST_MACRO);
saveLastMacro.setContext(textContext);
saveLastMacro.setText(Tr::tr("Save Last Macro"));
saveLastMacro.setEnabled(false);
saveLastMacro.addToContainer(Constants::M_TOOLS_MACRO);
saveLastMacro.setOnTriggered(this, [this] { d->macroManager.saveLastMacro(); });
saveLastMacro.addOnTriggered(this, [this] { d->macroManager.saveLastMacro(); });
}
private:

View File

@@ -57,7 +57,7 @@ SquishPluginPrivate::SquishPluginPrivate()
ActionBuilder serverSettings(this, "Squish.ServerSettings");
serverSettings.setText(Tr::tr("&Server Settings..."));
serverSettings.addToContainer(menuId);
serverSettings.setOnTriggered(this, [] {
serverSettings.addOnTriggered(this, [] {
if (!settings().squishPath().exists()) {
SquishMessages::criticalMessage(Tr::tr("Invalid Squish settings. Configure Squish "
"installation path inside "

View File

@@ -235,7 +235,7 @@ void TerminalPane::initActions()
newTerminalAction.setContext(m_selfContext);
newTerminalAction.setDefaultKeySequences({QKeySequence(
HostOsInfo::isMacHost() ? QLatin1String("Ctrl+T") : QLatin1String("Ctrl+Shift+T"))});
newTerminalAction.setOnTriggered(this, [this] { openTerminal({}); });
newTerminalAction.addOnTriggered(this, [this] { openTerminal({}); });
m_newTerminalAction = newTerminalAction.commandAction();
ActionBuilder closeTerminalAction(this, CLOSETERMINAL);
@@ -243,7 +243,7 @@ void TerminalPane::initActions()
closeTerminalAction.setIcon(CLOSE_TERMINAL_ICON.icon());
closeTerminalAction.setToolTip(Tr::tr("Close the current Terminal."));
closeTerminalAction.setContext(m_selfContext);
closeTerminalAction.setOnTriggered(this, [this] { removeTab(m_tabWidget.currentIndex()); });
closeTerminalAction.addOnTriggered(this, [this] { removeTab(m_tabWidget.currentIndex()); });
m_closeTerminalAction = closeTerminalAction.commandAction();
ActionBuilder nextTerminalAction(this, NEXTTERMINAL);
@@ -253,7 +253,7 @@ void TerminalPane::initActions()
{QKeySequence("Alt+Tab"),
QKeySequence(HostOsInfo::isMacHost() ? QLatin1String("Ctrl+Shift+[")
: QLatin1String("Ctrl+PgUp"))});
nextTerminalAction.setOnTriggered(this, [this] {
nextTerminalAction.addOnTriggered(this, [this] {
if (canNavigate())
goToNext();
});
@@ -265,7 +265,7 @@ void TerminalPane::initActions()
{QKeySequence("Alt+Shift+Tab"),
QKeySequence(HostOsInfo::isMacHost() ? QLatin1String("Ctrl+Shift+]")
: QLatin1String("Ctrl+PgDown"))});
prevTerminalAction.setOnTriggered(this, [this] {
prevTerminalAction.addOnTriggered(this, [this] {
if (canPrevious())
goToPrev();
});

View File

@@ -271,42 +271,42 @@ void TerminalWidget::setupActions()
ActionBuilder copyAction(this, Constants::COPY);
copyAction.setContext(m_context);
copyAction.setOnTriggered(this, &TerminalWidget::copyToClipboard);
copyAction.addOnTriggered(this, &TerminalWidget::copyToClipboard);
m_copy = make_registered(copyAction);
ActionBuilder pasteAction(this, Constants::PASTE);
pasteAction.setContext(m_context);
pasteAction.setOnTriggered(this, &TerminalWidget::pasteFromClipboard);
pasteAction.addOnTriggered(this, &TerminalWidget::pasteFromClipboard);
m_paste = make_registered(pasteAction);
ActionBuilder closeAction(this, Core::Constants::CLOSE);
closeAction.setContext(m_context);
closeAction.setOnTriggered(this, &TerminalWidget::closeTerminal);
closeAction.addOnTriggered(this, &TerminalWidget::closeTerminal);
m_close = make_registered(closeAction);
ActionBuilder clearTerminalAction(this, Constants::CLEAR_TERMINAL);
clearTerminalAction.setContext(m_context);
clearTerminalAction.setOnTriggered(this, &TerminalWidget::clearContents);
clearTerminalAction.addOnTriggered(this, &TerminalWidget::clearContents);
m_clearTerminal = make_registered(clearTerminalAction);
ActionBuilder clearSelectionAction(this, Constants::CLEARSELECTION);
clearSelectionAction.setContext(m_context);
clearSelectionAction.setOnTriggered(this, &TerminalWidget::clearSelection);
clearSelectionAction.addOnTriggered(this, &TerminalWidget::clearSelection);
m_clearSelection = make_registered(clearSelectionAction);
ActionBuilder moveCursorWordLeftAction(this, Constants::MOVECURSORWORDLEFT);
moveCursorWordLeftAction.setContext(m_context);
moveCursorWordLeftAction.setOnTriggered(this, &TerminalWidget::moveCursorWordLeft);
moveCursorWordLeftAction.addOnTriggered(this, &TerminalWidget::moveCursorWordLeft);
m_moveCursorWordLeft = make_registered(moveCursorWordLeftAction);
ActionBuilder moveCursorWordRightAction(this, Constants::MOVECURSORWORDRIGHT);
moveCursorWordRightAction.setContext(m_context);
moveCursorWordRightAction.setOnTriggered(this, &TerminalWidget::moveCursorWordRight);
moveCursorWordRightAction.addOnTriggered(this, &TerminalWidget::moveCursorWordRight);
m_moveCursorWordRight = make_registered(moveCursorWordRightAction);
ActionBuilder selectAllAction(this, Constants::SELECTALL);
selectAllAction.setContext(m_context);
selectAllAction.setOnTriggered(this, &TerminalWidget::selectAll);
selectAllAction.addOnTriggered(this, &TerminalWidget::selectAll);
m_selectAll = make_registered(selectAllAction);
// Ctrl+Q, the default "Quit" shortcut, is a useful key combination in a shell.

View File

@@ -128,7 +128,7 @@ TextEditorPluginPrivate::TextEditorPluginPrivate()
toggleAction.setTouchBarIcon(Icons::MACOS_TOUCHBAR_BOOKMARK.icon());
toggleAction.addToContainer(bookmarkMenuId);
toggleAction.bindContextAction(&m_toggleAction);
toggleAction.setOnTriggered(this, [this] {
toggleAction.addOnTriggered(this, [this] {
IEditor *editor = EditorManager::currentEditor();
auto widget = TextEditorWidget::fromEditor(editor);
if (widget && editor && !editor->document()->isTemporary())
@@ -141,7 +141,7 @@ TextEditorPluginPrivate::TextEditorPluginPrivate()
editAction.setDefaultKeySequence(Tr::tr("Meta+Shift+M"), Tr::tr("Ctrl+Shift+M"));
editAction.addToContainer(bookmarkMenuId);
editAction.bindContextAction(&m_editAction);
editAction.setOnTriggered(this, [this] {
editAction.addOnTriggered(this, [this] {
IEditor *editor = EditorManager::currentEditor();
auto widget = TextEditorWidget::fromEditor(editor);
if (widget && editor && !editor->document()->isTemporary()) {
@@ -163,7 +163,7 @@ TextEditorPluginPrivate::TextEditorPluginPrivate()
prevAction.setIcon(Icons::PREV_TOOLBAR.icon());
prevAction.setIconVisibleInMenu(false);
prevAction.bindContextAction(&m_prevAction);
prevAction.setOnTriggered(this, [this] { m_bookmarkManager.prev(); });
prevAction.addOnTriggered(this, [this] { m_bookmarkManager.prev(); });
ActionBuilder nextAction(this, BOOKMARKS_NEXT_ACTION);
nextAction.setContext(editorManagerContext);
@@ -173,7 +173,7 @@ TextEditorPluginPrivate::TextEditorPluginPrivate()
nextAction.setDefaultKeySequence(Tr::tr("Meta+."), Tr::tr("Ctrl+."));
nextAction.addToContainer(bookmarkMenuId);
nextAction.bindContextAction(&m_nextAction);
nextAction.setOnTriggered(this, [this] { m_bookmarkManager.next(); });
nextAction.addOnTriggered(this, [this] { m_bookmarkManager.next(); });
m_bookmarkMenu.addSeparator();
@@ -182,14 +182,14 @@ TextEditorPluginPrivate::TextEditorPluginPrivate()
docPrevAction.setText(Tr::tr("Previous Bookmark in Document"));
docPrevAction.addToContainer(bookmarkMenuId);
docPrevAction.bindContextAction(&m_docPrevAction);
docPrevAction.setOnTriggered(this, [this] { m_bookmarkManager.prevInDocument(); });
docPrevAction.addOnTriggered(this, [this] { m_bookmarkManager.prevInDocument(); });
ActionBuilder docNextAction(this, "Bookmarks.NextDocument");
docNextAction.setContext(Core::Constants::C_EDITORMANAGER);
docNextAction.setText(Tr::tr("Next Bookmark in Document"));
docNextAction.addToContainer(bookmarkMenuId);
docNextAction.bindContextAction(&m_docNextAction);
docNextAction.setOnTriggered(this, [this] { m_bookmarkManager.nextInDocument(); });
docNextAction.addOnTriggered(this, [this] { m_bookmarkManager.nextInDocument(); });
connect(&m_editBookmarkAction, &QAction::triggered, this, [this] {
m_bookmarkManager.editByFileAndLine(m_marginActionFileName, m_marginActionLineNumber);