diff --git a/src/plugins/texteditor/codeassist/asyncprocessor.cpp b/src/plugins/texteditor/codeassist/asyncprocessor.cpp index 2ab696af476..851ee49774b 100644 --- a/src/plugins/texteditor/codeassist/asyncprocessor.cpp +++ b/src/plugins/texteditor/codeassist/asyncprocessor.cpp @@ -12,7 +12,7 @@ namespace TextEditor { AsyncProcessor::AsyncProcessor() { - QObject::connect(&m_watcher, &QFutureWatcher::finished, [this]() { + QObject::connect(&m_watcher, &QFutureWatcher::finished, &m_watcher, [this] { setAsyncProposalAvailable(m_watcher.result()); }); } @@ -21,7 +21,7 @@ IAssistProposal *AsyncProcessor::perform() { IAssistProposal *result = immediateProposal(); interface()->prepareForAsyncUse(); - m_watcher.setFuture(Utils::runAsync([this]() { + m_watcher.setFuture(Utils::runAsync([this] { interface()->recreateTextDocument(); return performAsync(); })); diff --git a/src/plugins/texteditor/displaysettingspage.cpp b/src/plugins/texteditor/displaysettingspage.cpp index 8713ed50d91..b0bfee85a88 100644 --- a/src/plugins/texteditor/displaysettingspage.cpp +++ b/src/plugins/texteditor/displaysettingspage.cpp @@ -55,12 +55,13 @@ public: fontSettingsPageLineSpacing = fontSettingsPageLineSpacingLink(); if (fontSettingsPageLineSpacing) { - connect(fontSettingsPageLineSpacing, QOverload::of(&QSpinBox::valueChanged), - [=](const int &value) { - if (value != 100) - enableTextWrapping->setChecked(false); - enableTextWrapping->setEnabled(value == 100); - enableTextWrappingHintLabel->setVisible(value != 100); } ); + connect(fontSettingsPageLineSpacing, &QSpinBox::valueChanged, + this, [this](const int &value) { + if (value != 100) + enableTextWrapping->setChecked(false); + enableTextWrapping->setEnabled(value == 100); + enableTextWrappingHintLabel->setVisible(value != 100); + }); if (fontSettingsPageLineSpacing->value() != 100) enableTextWrapping->setChecked(false); @@ -69,7 +70,7 @@ public: enableTextWrappingHintLabel->setVisible(fontSettingsPageLineSpacing->value() != 100); } - connect(enableTextWrappingHintLabel, &QLabel::linkActivated, []() { + connect(enableTextWrappingHintLabel, &QLabel::linkActivated, [] { Core::ICore::showOptionsDialog(Constants::TEXT_EDITOR_FONT_SETTINGS); } ); diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 674e6aab52b..19b9bebd423 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -104,7 +104,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe QAction *completionAction = new QAction(tr("Trigger Completion"), this); Command *command = ActionManager::registerAction(completionAction, Constants::COMPLETE_THIS, context); command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+Space") : tr("Ctrl+Space"))); - connect(completionAction, &QAction::triggered, []() { + connect(completionAction, &QAction::triggered, this, [] { if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor()) editor->editorWidget()->invokeAssist(Completion); }); @@ -118,7 +118,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe command = ActionManager::registerAction(functionHintAction, Constants::FUNCTION_HINT, context); command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+Shift+D") : tr("Ctrl+Shift+D"))); - connect(functionHintAction, &QAction::triggered, []() { + connect(functionHintAction, &QAction::triggered, this, [] { if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor()) editor->editorWidget()->invokeAssist(FunctionHint); }); @@ -127,7 +127,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe QAction *quickFixAction = new QAction(tr("Trigger Refactoring Action"), this); Command *quickFixCommand = ActionManager::registerAction(quickFixAction, Constants::QUICKFIX_THIS, context); quickFixCommand->setDefaultKeySequence(QKeySequence(tr("Alt+Return"))); - connect(quickFixAction, &QAction::triggered, []() { + connect(quickFixAction, &QAction::triggered, this, [] { if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor()) editor->editorWidget()->invokeAssist(QuickFix); }); @@ -136,7 +136,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe ActionManager::registerAction(showContextMenuAction, Constants::SHOWCONTEXTMENU, context); - connect(showContextMenuAction, &QAction::triggered, []() { + connect(showContextMenuAction, &QAction::triggered, this, [] { if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor()) editor->editorWidget()->showContextMenu(); }); @@ -154,11 +154,10 @@ void TextEditorPluginPrivate::extensionsInitialized() { connect(FolderNavigationWidgetFactory::instance(), &FolderNavigationWidgetFactory::aboutToShowContextMenu, - this, - [](QMenu *menu, const FilePath &filePath, bool isDir) { + this, [](QMenu *menu, const FilePath &filePath, bool isDir) { if (!isDir && Core::DiffService::instance()) { menu->addAction(TextEditor::TextDocument::createDiffAgainstCurrentFileAction( - menu, [filePath]() { return filePath; })); + menu, [filePath] { return filePath; })); } }); @@ -231,8 +230,7 @@ void TextEditorPlugin::extensionsInitialized() }); expander->registerVariable(kCurrentDocumentWordUnderCursor, - tr("Word under the current document's text cursor."), - []() { + tr("Word under the current document's text cursor."), [] { BaseTextEditor *editor = BaseTextEditor::currentTextEditor(); if (!editor) return QString();