forked from qt-creator/qt-creator
CMakeProjectManager: Pass context object to lambda connections
Remove some unneeded lambda () brackets. Remove some unneeded lambda return type specifiers. Change-Id: I9695367d66a151f2611554b9fe5897c1bac7ef5c Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -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<QtSupport::QmlDebuggingAspect>();
|
||||
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");
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -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; });
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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());
|
||||
});
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -836,7 +836,7 @@ FileApiData FileApiParser::parseData(QFutureInterface<std::shared_ptr<FileApiQtc
|
||||
|
||||
FileApiData result;
|
||||
|
||||
const auto cancelCheck = [&fi, &errorMessage]() -> bool {
|
||||
const auto cancelCheck = [&fi, &errorMessage] {
|
||||
if (fi.isCanceled()) {
|
||||
errorMessage = Tr::tr("CMake parsing was canceled.");
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user