diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index 1f9829a2276..c2a98dc214f 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -184,7 +184,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) : auto buildDirAspect = bc->buildDirectoryAspect(); buildDirAspect->setAutoApplyOnEditingFinished(true); - connect(buildDirAspect, &BaseAspect::changed, this, [this]() { + connect(buildDirAspect, &BaseAspect::changed, this, [this] { m_configModel->flush(); // clear out config cache...; }); @@ -199,7 +199,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) : }); auto qmlDebugAspect = bc->aspect(); - connect(qmlDebugAspect, &QtSupport::QmlDebuggingAspect::changed, this, [this]() { + connect(qmlDebugAspect, &QtSupport::QmlDebuggingAspect::changed, this, [this] { updateButtonState(); }); @@ -216,7 +216,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) : m_kitConfiguration = new QPushButton(Tr::tr("Kit Configuration")); m_kitConfiguration->setToolTip(Tr::tr("Edit the current kit's CMake configuration.")); m_kitConfiguration->setFixedWidth(m_kitConfiguration->sizeHint().width()); - connect(m_kitConfiguration, &QPushButton::clicked, this, [this]() { kitCMakeConfiguration(); }); + connect(m_kitConfiguration, &QPushButton::clicked, this, [this] { kitCMakeConfiguration(); }); m_filterEdit = new FancyLineEdit; m_filterEdit->setPlaceholderText(Tr::tr("Filter")); @@ -238,7 +238,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) : m_configTextFilterModel->setFilterKeyColumn(-1); m_configTextFilterModel->setNewItemRole(ConfigModel::ItemIsUserNew); - connect(m_configTextFilterModel, &QAbstractItemModel::layoutChanged, this, [this]() { + connect(m_configTextFilterModel, &QAbstractItemModel::layoutChanged, this, [this] { QModelIndex selectedIdx = m_configView->currentIndex(); if (selectedIdx.isValid()) m_configView->scrollTo(selectedIdx); @@ -266,7 +266,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) : m_progressIndicator->hide(); m_showProgressTimer.setSingleShot(true); m_showProgressTimer.setInterval(50); // don't show progress for < 50ms tasks - connect(&m_showProgressTimer, &QTimer::timeout, [this]() { m_progressIndicator->show(); }); + connect(&m_showProgressTimer, &QTimer::timeout, this, [this] { m_progressIndicator->show(); }); m_addButton = new QPushButton(Tr::tr("&Add")); m_addButton->setToolTip(Tr::tr("Add a new configuration value.")); @@ -453,7 +453,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) : QRegularExpression::CaseInsensitiveOption)); }); - connect(m_resetButton, &QPushButton::clicked, this, [this](){ + connect(m_resetButton, &QPushButton::clicked, this, [this] { m_configModel->resetAllChanges(isInitialConfiguration()); }); connect(m_reconfigureButton, &QPushButton::clicked, this, [this] { @@ -468,11 +468,11 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) : m_reconfigureButton->setEnabled(false); } }); - connect(m_setButton, &QPushButton::clicked, this, [this]() { setVariableUnsetFlag(false); }); - connect(m_unsetButton, &QPushButton::clicked, this, [this]() { + connect(m_setButton, &QPushButton::clicked, this, [this] { setVariableUnsetFlag(false); }); + connect(m_unsetButton, &QPushButton::clicked, this, [this] { setVariableUnsetFlag(true); }); - connect(m_editButton, &QPushButton::clicked, this, [this]() { + connect(m_editButton, &QPushButton::clicked, this, [this] { QModelIndex idx = m_configView->currentIndex(); if (idx.column() != 1) idx = idx.sibling(idx.row(), 1); @@ -1023,7 +1023,7 @@ QAction *CMakeBuildSettingsWidget::createForceAction(int type, const QModelIndex QAction *forceAction = new QAction(Tr::tr("Force to %1").arg(typeString), nullptr); forceAction->setEnabled(m_configModel->canForceTo(idx, t)); connect(forceAction, &QAction::triggered, - this, [this, idx, t]() { m_configModel->forceTo(idx, t); }); + this, [this, idx, t] { m_configModel->forceTo(idx, t); }); return forceAction; } @@ -1603,7 +1603,7 @@ bool CMakeBuildConfiguration::fromMap(const QVariantMap &map) [](const CMakeConfigItem &c) { return !c.isNull(); }); // TODO: Upgrade from Qt Creator < 4.13: Remove when no longer supported! - const QString buildTypeName = [this]() { + const QString buildTypeName = [this] { switch (buildType()) { case Debug: return QString("Debug"); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 823f091e6ca..b26c8acc7eb 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -790,12 +790,12 @@ void CMakeBuildSystem::wireUpConnections() // trigger an initial parser run // Became active/inactive: - connect(target(), &Target::activeBuildConfigurationChanged, this, [this]() { + connect(target(), &Target::activeBuildConfigurationChanged, this, [this] { // Build configuration has changed: qCDebug(cmakeBuildSystemLog) << "Requesting parse due to active BC changed"; reparse(CMakeBuildSystem::REPARSE_DEFAULT); }); - connect(project(), &Project::activeTargetChanged, this, [this]() { + connect(project(), &Project::activeTargetChanged, this, [this] { // Build configuration has changed: qCDebug(cmakeBuildSystemLog) << "Requesting parse due to active target changed"; reparse(CMakeBuildSystem::REPARSE_DEFAULT); diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index e7463c40eae..fc632ccd977 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -223,8 +223,8 @@ CMakeEditorFactory::CMakeEditorFactory() addMimeType(Constants::CMAKE_MIMETYPE); addMimeType(Constants::CMAKE_PROJECT_MIMETYPE); - setEditorCreator([]() { return new CMakeEditor; }); - setEditorWidgetCreator([]() { return new CMakeEditorWidget; }); + setEditorCreator([] { return new CMakeEditor; }); + setEditorWidgetCreator([] { return new CMakeEditorWidget; }); setDocumentCreator(createCMakeDocument); setIndenterCreator([](QTextDocument *doc) { return new CMakeIndenter(doc); }); setUseGenericHighlighter(true); @@ -232,7 +232,7 @@ CMakeEditorFactory::CMakeEditorFactory() setCodeFoldingSupported(true); setCompletionAssistProvider(new CMakeFileCompletionAssistProvider); - setAutoCompleterCreator([]() { return new CMakeAutoCompleter; }); + setAutoCompleterCreator([] { return new CMakeAutoCompleter; }); setEditorActionHandlers(TextEditorActionHandler::UnCommentSelection | TextEditorActionHandler::JumpToFileUnderCursor diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp index c450bc814bd..c6c4a2ea2e2 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp @@ -203,11 +203,11 @@ CMakeKitAspect::CMakeKitAspect() //make sure the default value is set if a selected CMake is removed connect(CMakeToolManager::instance(), &CMakeToolManager::cmakeRemoved, - [this] { for (Kit *k : KitManager::kits()) fix(k); }); + this, [this] { for (Kit *k : KitManager::kits()) fix(k); }); //make sure the default value is set if a new default CMake is set connect(CMakeToolManager::instance(), &CMakeToolManager::defaultCMakeChanged, - [this] { for (Kit *k : KitManager::kits()) fix(k); }); + this, [this] { for (Kit *k : KitManager::kits()) fix(k); }); } Id CMakeKitAspect::id() @@ -677,7 +677,7 @@ QVariant CMakeGeneratorKitAspect::defaultValue(const Kit *k) const return g.matches("Ninja"); }); if (it != known.constEnd()) { - const bool hasNinja = [k, tool]() { + const bool hasNinja = [k, tool] { Internal::CMakeSpecificSettings *settings = Internal::CMakeProjectPlugin::projectTypeSpecificSettings(); @@ -951,7 +951,7 @@ private: auto chooser = new VariableChooser(m_dialog); chooser->addSupportedWidget(m_editor); - chooser->addMacroExpanderProvider([this]() { return kit()->macroExpander(); }); + chooser->addMacroExpanderProvider([this] { return kit()->macroExpander(); }); m_additionalEditor = new QLineEdit; auto additionalLabel = new QLabel(m_dialog); @@ -962,7 +962,7 @@ private: auto additionalChooser = new VariableChooser(m_dialog); additionalChooser->addSupportedWidget(m_additionalEditor); - additionalChooser->addMacroExpanderProvider([this]() { return kit()->macroExpander(); }); + additionalChooser->addMacroExpanderProvider([this] { return kit()->macroExpander(); }); auto additionalLayout = new QHBoxLayout(); additionalLayout->addWidget(additionalLabel); diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp index f8f536e22db..a46bb03542c 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp @@ -142,8 +142,8 @@ FilePaths CMakeProjectImporter::importCandidates() CMakePresets::Macros::expand(configPreset, env, projectDirectory(), binaryDir); const FilePath binaryFilePath = FilePath::fromString(binaryDir); - candidates.removeIf( - [&binaryFilePath] (const FilePath &path) { return path == binaryFilePath; }); + candidates.removeIf([&binaryFilePath](const FilePath &path) + { return path == binaryFilePath; }); } } diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index eaf2261b06c..7e7f267d3d6 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -56,7 +56,7 @@ CMakeManager::CMakeManager() globalContext); command->setAttribute(Core::Command::CA_Hide); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); - connect(m_runCMakeAction, &QAction::triggered, [this]() { + connect(m_runCMakeAction, &QAction::triggered, this, [this] { runCMake(SessionManager::startupBuildSystem()); }); @@ -65,7 +65,7 @@ CMakeManager::CMakeManager() globalContext); command->setAttribute(Core::Command::CA_Hide); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); - connect(m_clearCMakeCacheAction, &QAction::triggered, [this]() { + connect(m_clearCMakeCacheAction, &QAction::triggered, this, [this] { clearCMakeCache(SessionManager::startupBuildSystem()); }); @@ -75,7 +75,7 @@ CMakeManager::CMakeManager() command->setAttribute(Core::Command::CA_Hide); mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); - connect(m_runCMakeActionContextMenu, &QAction::triggered, [this]() { + connect(m_runCMakeActionContextMenu, &QAction::triggered, this, [this] { runCMake(ProjectTree::currentBuildSystem()); }); @@ -93,7 +93,7 @@ CMakeManager::CMakeManager() globalContext); command->setAttribute(Core::Command::CA_Hide); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); - connect(m_rescanProjectAction, &QAction::triggered, [this]() { + connect(m_rescanProjectAction, &QAction::triggered, this, [this] { rescanProject(ProjectTree::currentBuildSystem()); }); diff --git a/src/plugins/cmakeprojectmanager/configmodel.cpp b/src/plugins/cmakeprojectmanager/configmodel.cpp index 43fb28d7d06..52f83d9c4b8 100644 --- a/src/plugins/cmakeprojectmanager/configmodel.cpp +++ b/src/plugins/cmakeprojectmanager/configmodel.cpp @@ -550,7 +550,7 @@ QVariant ConfigModelTreeItem::data(int column, int role) const return dataItem->isUserNew ? "1" : "0"; } - auto fontRole = [this]() -> QFont { + auto fontRole = [this] { QFont font; font.setBold((dataItem->isUserChanged || dataItem->isUserNew) && !dataItem->isUnset); font.setStrikeOut((!dataItem->inCMakeCache && !dataItem->isUserNew) || dataItem->isUnset); diff --git a/src/plugins/cmakeprojectmanager/fileapiparser.cpp b/src/plugins/cmakeprojectmanager/fileapiparser.cpp index 4bd91cfbe28..24feaf215ce 100644 --- a/src/plugins/cmakeprojectmanager/fileapiparser.cpp +++ b/src/plugins/cmakeprojectmanager/fileapiparser.cpp @@ -836,7 +836,7 @@ FileApiData FileApiParser::parseData(QFutureInterface bool { + const auto cancelCheck = [&fi, &errorMessage] { if (fi.isCanceled()) { errorMessage = Tr::tr("CMake parsing was canceled."); return true;