Various plugins: Fix some more C++20 warnings about [=] captures

Change-Id: If20aac4320c84096a07d67cc137886638286acf8
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Jarek Kobus
2024-02-05 20:50:49 +01:00
parent 97e582c3c0
commit 8bcc78a044
23 changed files with 76 additions and 69 deletions

View File

@@ -80,7 +80,7 @@ DriverSelector::DriverSelector(const QStringList &supportedDrivers, QWidget *par
const auto detailsPanel = new DriverSelectorDetailsPanel(m_selection); const auto detailsPanel = new DriverSelectorDetailsPanel(m_selection);
setWidget(detailsPanel); setWidget(detailsPanel);
connect(toolPanel, &DriverSelectorToolPanel::clicked, this, [=] { connect(toolPanel, &DriverSelectorToolPanel::clicked, this, [this, supportedDrivers] {
DriverSelectionDialog dialog(m_toolsIniFile, supportedDrivers, this); DriverSelectionDialog dialog(m_toolsIniFile, supportedDrivers, this);
const int result = dialog.exec(); const int result = dialog.exec();
if (result != QDialog::Accepted) if (result != QDialog::Accepted)

View File

@@ -1474,7 +1474,7 @@ void ClangdTestHighlighting::test()
const auto lessThan = [=](const TextEditor::HighlightingResult &r, int) { const auto lessThan = [=](const TextEditor::HighlightingResult &r, int) {
return Text::positionInText(doc->document(), r.line, r.column) < startPos; return Text::positionInText(doc->document(), r.line, r.column) < startPos;
}; };
const auto findResults = [=] { const auto findResults = [this, endPos, lessThan, doc] {
TextEditor::HighlightingResults results; TextEditor::HighlightingResults results;
auto it = std::lower_bound(m_results.cbegin(), m_results.cend(), 0, lessThan); auto it = std::lower_bound(m_results.cbegin(), m_results.cend(), 0, lessThan);
if (it == m_results.cend()) if (it == m_results.cend())

View File

@@ -1196,7 +1196,7 @@ void DiagnosticConfigsWidget::handleChecksAsStringsButtonClicked(BaseChecksTreeM
buttonsBox buttonsBox
}.attachTo(&dialog); }.attachTo(&dialog);
QObject::connect(&dialog, &QDialog::accepted, this, [=, &initialChecks] { QObject::connect(&dialog, &QDialog::accepted, this, [this, model, textEdit, &initialChecks] {
const QString updatedChecks = textEdit->toPlainText(); const QString updatedChecks = textEdit->toPlainText();
if (updatedChecks == initialChecks) if (updatedChecks == initialChecks)
return; return;

View File

@@ -95,8 +95,8 @@ FilterDialog::FilterDialog(const Checks &checks, QWidget *parent)
buttonBox, buttonBox,
}.attachTo(this); }.attachTo(this);
connect(m_view->selectionModel(), &QItemSelectionModel::selectionChanged, this, [=] { connect(m_view->selectionModel(), &QItemSelectionModel::selectionChanged, this, [this, buttonBox] {
const bool hasSelection = !this->m_view->selectionModel()->selectedRows().isEmpty(); const bool hasSelection = !m_view->selectionModel()->selectedRows().isEmpty();
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(hasSelection); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(hasSelection);
}); });

View File

@@ -554,7 +554,7 @@ void CMakeBuildSettingsWidget::batchEditConfiguration()
connect(buttons, &QDialogButtonBox::accepted, dialog, &QDialog::accept); connect(buttons, &QDialogButtonBox::accepted, dialog, &QDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, dialog, &QDialog::reject); connect(buttons, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
connect(dialog, &QDialog::accepted, this, [=]{ connect(dialog, &QDialog::accepted, this, [this, editor] {
const auto expander = m_buildConfig->macroExpander(); const auto expander = m_buildConfig->macroExpander();
const QStringList lines = editor->toPlainText().split('\n', Qt::SkipEmptyParts); const QStringList lines = editor->toPlainText().split('\n', Qt::SkipEmptyParts);
@@ -1012,7 +1012,7 @@ bool CMakeBuildSettingsWidget::eventFilter(QObject *target, QEvent *event)
auto help = new QAction(Tr::tr("Help"), this); auto help = new QAction(Tr::tr("Help"), this);
menu->addAction(help); menu->addAction(help);
connect(help, &QAction::triggered, this, [=] { connect(help, &QAction::triggered, this, [this, idx] {
const CMakeConfigItem item = ConfigModel::dataItemFromIndex(idx).toCMakeConfigItem(); const CMakeConfigItem item = ConfigModel::dataItemFromIndex(idx).toCMakeConfigItem();
const CMakeTool *tool = CMakeKitAspect::cmakeTool(m_buildConfig->target()->kit()); const CMakeTool *tool = CMakeKitAspect::cmakeTool(m_buildConfig->target()->kit());

View File

@@ -322,8 +322,8 @@ QObject *CorePlugin::remoteCommand(const QStringList & /* options */,
{ {
if (!ExtensionSystem::PluginManager::isInitializationDone()) { if (!ExtensionSystem::PluginManager::isInitializationDone()) {
connect(ExtensionSystem::PluginManager::instance(), connect(ExtensionSystem::PluginManager::instance(),
&ExtensionSystem::PluginManager::initializationDone, &ExtensionSystem::PluginManager::initializationDone, this,
this, [=] { remoteCommand(QStringList(), workingDirectory, args); }); [this, workingDirectory, args] { remoteCommand({}, workingDirectory, args); });
return nullptr; return nullptr;
} }
const FilePaths filePaths = Utils::transform(args, FilePath::fromUserInput); const FilePaths filePaths = Utils::transform(args, FilePath::fromUserInput);

View File

@@ -616,12 +616,11 @@ void CppEditorWidget::renameUsages(const QString &replacement, QTextCursor curso
cursor = textCursor(); cursor = textCursor();
// First check if the symbol to be renamed comes from a generated file. // First check if the symbol to be renamed comes from a generated file.
LinkHandler continuation = [=, self = QPointer(this)](const Link &link) { LinkHandler continuation = [this, cursor, replacement, self = QPointer(this)](const Link &link) {
if (!self) if (!self)
return; return;
showRenameWarningIfFileIsGenerated(link.targetFilePath); showRenameWarningIfFileIsGenerated(link.targetFilePath);
CursorInEditor cursorInEditor{cursor, textDocument()->filePath(), this, textDocument()}; const CursorInEditor cursorInEditor{cursor, textDocument()->filePath(), this, textDocument()};
QPointer<CppEditorWidget> cppEditorWidget = this;
CppModelManager::globalRename(cursorInEditor, replacement); CppModelManager::globalRename(cursorInEditor, replacement);
}; };
CppModelManager::followSymbol(CursorInEditor{cursor, CppModelManager::followSymbol(CursorInEditor{cursor,
@@ -847,7 +846,8 @@ void CppEditorWidget::renameSymbolUnderCursor()
QPointer<CppEditorWidget> cppEditorWidget = this; QPointer<CppEditorWidget> cppEditorWidget = this;
auto renameSymbols = [=](const QString &symbolName, const Links &links, int revision) { auto renameSymbols = [this, cppEditorWidget](const QString &symbolName, const Links &links,
int revision) {
if (cppEditorWidget) { if (cppEditorWidget) {
viewport()->setCursor(Qt::IBeamCursor); viewport()->setCursor(Qt::IBeamCursor);
@@ -1121,8 +1121,8 @@ QMenu *CppEditorWidget::createRefactorMenu(QWidget *parent) const
auto *progressIndicatorMenuItem = new ProgressIndicatorMenuItem(menu); auto *progressIndicatorMenuItem = new ProgressIndicatorMenuItem(menu);
menu->addAction(progressIndicatorMenuItem); menu->addAction(progressIndicatorMenuItem);
connect(&d->m_useSelectionsUpdater, &CppUseSelectionsUpdater::finished, connect(&d->m_useSelectionsUpdater, &CppUseSelectionsUpdater::finished, menu,
menu, [=] (SemanticInfo::LocalUseMap, bool success) { [this, menu, progressIndicatorMenuItem] (SemanticInfo::LocalUseMap, bool success) {
QTC_CHECK(success); QTC_CHECK(success);
menu->removeAction(progressIndicatorMenuItem); menu->removeAction(progressIndicatorMenuItem);
addRefactoringActions(menu); addRefactoringActions(menu);

View File

@@ -4783,8 +4783,9 @@ public:
checkbox->setCheckState(Qt::Checked); checkbox->setCheckState(Qt::Checked);
}; };
using Column = CandidateTreeItem::Column; using Column = CandidateTreeItem::Column;
const auto createConnections = [=](QCheckBox *checkbox, Column column) { const auto createConnections = [this, setCheckStateForAll, preventPartiallyChecked](
connect(checkbox, &QCheckBox::stateChanged, [setCheckStateForAll, column](int state) { QCheckBox *checkbox, Column column) {
connect(checkbox, &QCheckBox::stateChanged, this, [setCheckStateForAll, column](int state) {
if (state != Qt::PartiallyChecked) if (state != Qt::PartiallyChecked)
setCheckStateForAll(column, state); setCheckStateForAll(column, state);
}); });

View File

@@ -1397,7 +1397,7 @@ void CdbEngine::fetchMemory(MemoryAgent *agent, quint64 address, quint64 length)
StringInputStream str(args); StringInputStream str(args);
str << address << ' ' << length; str << address << ' ' << length;
cmd.args = args; cmd.args = args;
cmd.callback = [=](const DebuggerResponse &response) { cmd.callback = [this, agent, length, address](const DebuggerResponse &response) {
if (!agent) if (!agent)
return; return;
if (response.resultClass == ResultDone) { if (response.resultClass == ResultDone) {

View File

@@ -708,7 +708,8 @@ void FossilClient::annotate(const FilePath &workingDir, const QString &file, int
if (VcsBaseEditorConfig *editorConfig = createAnnotateEditor(fossilEditor)) { if (VcsBaseEditorConfig *editorConfig = createAnnotateEditor(fossilEditor)) {
editorConfig->setBaseArguments(extraOptions); editorConfig->setBaseArguments(extraOptions);
// editor has been just created, createVcsEditor() didn't set a configuration widget yet // editor has been just created, createVcsEditor() didn't set a configuration widget yet
connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, this, [=] { connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, this,
[this, workingDir, file, revision, editorConfig] {
const int line = VcsBaseEditor::lineNumberOfCurrentEditor(); const int line = VcsBaseEditor::lineNumberOfCurrentEditor();
annotate(workingDir, file, line, revision, editorConfig->arguments()); annotate(workingDir, file, line, revision, editorConfig->arguments());
}); });
@@ -914,7 +915,8 @@ void FossilClient::log(const FilePath &workingDir, const QStringList &files,
if (VcsBaseEditorConfig *editorConfig = createLogEditor(fossilEditor)) { if (VcsBaseEditorConfig *editorConfig = createLogEditor(fossilEditor)) {
editorConfig->setBaseArguments(extraOptions); editorConfig->setBaseArguments(extraOptions);
// editor has been just created, createVcsEditor() didn't set a configuration widget yet // editor has been just created, createVcsEditor() didn't set a configuration widget yet
connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, this, [=] { connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, this,
[this, workingDir, files, editorConfig, enableAnnotationContextMenu, addAuthOptions] {
log(workingDir, files, editorConfig->arguments(), enableAnnotationContextMenu, log(workingDir, files, editorConfig->arguments(), enableAnnotationContextMenu,
addAuthOptions); addAuthOptions);
}); });
@@ -969,7 +971,8 @@ void FossilClient::logCurrentFile(const FilePath &workingDir, const QStringList
if (VcsBaseEditorConfig *editorConfig = createLogCurrentFileEditor(fossilEditor)) { if (VcsBaseEditorConfig *editorConfig = createLogCurrentFileEditor(fossilEditor)) {
editorConfig->setBaseArguments(extraOptions); editorConfig->setBaseArguments(extraOptions);
// editor has been just created, createVcsEditor() didn't set a configuration widget yet // editor has been just created, createVcsEditor() didn't set a configuration widget yet
connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, this, [=] { connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, this,
[this, workingDir, files, editorConfig, enableAnnotationContextMenu, addAuthOptions] {
logCurrentFile(workingDir, files, editorConfig->arguments(), logCurrentFile(workingDir, files, editorConfig->arguments(),
enableAnnotationContextMenu, addAuthOptions); enableAnnotationContextMenu, addAuthOptions);
}); });

View File

@@ -1055,7 +1055,9 @@ void GitClient::log(const FilePath &workingDirectory, const QString &fileName,
argWidget = new GitLogArgumentsWidget(!fileName.isEmpty(), editor); argWidget = new GitLogArgumentsWidget(!fileName.isEmpty(), editor);
argWidget->setBaseArguments(args); argWidget->setBaseArguments(args);
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested, this, connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested, this,
[=] { this->log(workingDir, fileName, enableAnnotationContextMenu, args); }); [this, workingDir, fileName, enableAnnotationContextMenu, args] {
log(workingDir, fileName, enableAnnotationContextMenu, args);
});
editor->setEditorConfig(argWidget); editor->setEditorConfig(argWidget);
} }
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu); editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
@@ -1112,7 +1114,7 @@ void GitClient::reflog(const FilePath &workingDirectory, const QString &ref)
if (!ref.isEmpty()) if (!ref.isEmpty())
argWidget->setBaseArguments({ref}); argWidget->setBaseArguments({ref});
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested, this, connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested, this,
[=] { this->reflog(workingDir, ref); }); [this, workingDir, ref] { reflog(workingDir, ref); });
editor->setEditorConfig(argWidget); editor->setEditorConfig(argWidget);
} }
editor->setWorkingDirectory(workingDir); editor->setWorkingDirectory(workingDir);
@@ -1222,7 +1224,8 @@ void GitClient::annotate(const Utils::FilePath &workingDir, const QString &file,
if (!argWidget) { if (!argWidget) {
argWidget = new GitBlameArgumentsWidget(editor->toolBar()); argWidget = new GitBlameArgumentsWidget(editor->toolBar());
argWidget->setBaseArguments(extraOptions); argWidget->setBaseArguments(extraOptions);
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested, this, [=] { connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested, this,
[this, workingDir, file, revision, extraOptions] {
const int line = VcsBaseEditor::lineNumberOfCurrentEditor(); const int line = VcsBaseEditor::lineNumberOfCurrentEditor();
annotate(workingDir, file, line, revision, extraOptions); annotate(workingDir, file, line, revision, extraOptions);
}); });
@@ -1248,7 +1251,7 @@ void GitClient::checkout(const FilePath &workingDirectory, const QString &ref, S
return; return;
const QStringList arguments = setupCheckoutArguments(workingDirectory, ref); const QStringList arguments = setupCheckoutArguments(workingDirectory, ref);
const auto commandHandler = [=](const CommandResult &result) { const auto commandHandler = [this, stashMode, workingDirectory, handler](const CommandResult &result) {
if (stashMode == StashMode::TryStash) if (stashMode == StashMode::TryStash)
endStashScope(workingDirectory); endStashScope(workingDirectory);
if (result.result() == ProcessResult::FinishedWithSuccess) if (result.result() == ProcessResult::FinishedWithSuccess)
@@ -2442,7 +2445,8 @@ void GitClient::tryLaunchingGitK(const Environment &env,
process->setWorkingDirectory(workingDirectory); process->setWorkingDirectory(workingDirectory);
process->setEnvironment(env); process->setEnvironment(env);
process->setCommand({binary, arguments}); process->setCommand({binary, arguments});
connect(process, &Process::done, this, [=] { connect(process, &Process::done, this,
[this, process, env, workingDirectory, fileName, trial, gitBinDirectory] {
if (process->result() == ProcessResult::StartFailed) if (process->result() == ProcessResult::StartFailed)
handleGitKFailedToStart(env, workingDirectory, fileName, trial, gitBinDirectory); handleGitKFailedToStart(env, workingDirectory, fileName, trial, gitBinDirectory);
process->deleteLater(); process->deleteLater();

View File

@@ -227,7 +227,9 @@ public:
menu->addAction(Tr::tr("&Copy \"%1\"").arg(reference), menu->addAction(Tr::tr("&Copy \"%1\"").arg(reference),
[reference] { setClipboardAndSelection(reference); }); [reference] { setClipboardAndSelection(reference); });
QAction *action = menu->addAction(Tr::tr("&Describe Change %1").arg(reference), QAction *action = menu->addAction(Tr::tr("&Describe Change %1").arg(reference),
[=] { vcsDescribe(workingDirectory, reference); }); [this, workingDirectory, reference] {
vcsDescribe(workingDirectory, reference);
});
menu->setDefaultAction(action); menu->setDefaultAction(action);
GitClient::addChangeActions(menu, workingDirectory, reference); GitClient::addChangeActions(menu, workingDirectory, reference);
} }
@@ -741,7 +743,7 @@ GitPluginPrivate::GitPluginPrivate()
Tr::tr("Update Submodules"), "Git.SubmoduleUpdate", Tr::tr("Update Submodules"), "Git.SubmoduleUpdate",
context, true, std::bind(&GitPluginPrivate::updateSubmodules, this)); context, true, std::bind(&GitPluginPrivate::updateSubmodules, this));
auto createAction = [=](const QString &text, Id id, auto createAction = [this, localRepositoryMenu, context](const QString &text, Id id,
const std::function<void(const FilePath &)> &callback) { const std::function<void(const FilePath &)> &callback) {
auto actionHandler = [this, callback] { auto actionHandler = [this, callback] {
if (!DocumentManager::saveAllModifiedDocuments()) if (!DocumentManager::saveAllModifiedDocuments())

View File

@@ -100,20 +100,23 @@ QWidget *IosBuildStep::createConfigWidget()
updateDetails(); updateDetails();
connect(buildArgumentsTextEdit, &QPlainTextEdit::textChanged, this, [=] { connect(buildArgumentsTextEdit, &QPlainTextEdit::textChanged, this,
[this, buildArgumentsTextEdit, resetDefaultsButton, updateDetails] {
setBaseArguments(ProcessArgs::splitArgs(buildArgumentsTextEdit->toPlainText(), setBaseArguments(ProcessArgs::splitArgs(buildArgumentsTextEdit->toPlainText(),
HostOsInfo::hostOs())); HostOsInfo::hostOs()));
resetDefaultsButton->setEnabled(!m_useDefaultArguments); resetDefaultsButton->setEnabled(!m_useDefaultArguments);
updateDetails(); updateDetails();
}); });
connect(resetDefaultsButton, &QAbstractButton::clicked, this, [=] { connect(resetDefaultsButton, &QAbstractButton::clicked, this,
[this, buildArgumentsTextEdit, resetDefaultsButton] {
setBaseArguments(defaultArguments()); setBaseArguments(defaultArguments());
buildArgumentsTextEdit->setPlainText(ProcessArgs::joinArgs(baseArguments())); buildArgumentsTextEdit->setPlainText(ProcessArgs::joinArgs(baseArguments()));
resetDefaultsButton->setEnabled(!m_useDefaultArguments); resetDefaultsButton->setEnabled(!m_useDefaultArguments);
}); });
connect(extraArgumentsLineEdit, &QLineEdit::editingFinished, this, [=] { connect(extraArgumentsLineEdit, &QLineEdit::editingFinished, this,
[this, extraArgumentsLineEdit] {
setExtraArguments(ProcessArgs::splitArgs(extraArgumentsLineEdit->text(), setExtraArguments(ProcessArgs::splitArgs(extraArgumentsLineEdit->text(),
HostOsInfo::hostOs())); HostOsInfo::hostOs()));
}); });

View File

@@ -885,7 +885,8 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext
stop(0); stop(0);
}; };
auto onResponseAppLaunch = [=](const SimulatorControl::Response &response) { auto onResponseAppLaunch = [this, captureConsole, monitorPid, stdoutFile, stderrFile](
const SimulatorControl::Response &response) {
if (response) { if (response) {
if (!isResponseValid(*response)) if (!isResponseValid(*response))
return; return;

View File

@@ -105,7 +105,7 @@ public:
} }
void sendMessage(const JsonRpcMessage &message) void sendMessage(const JsonRpcMessage &message)
{ {
QMetaObject::invokeMethod(m_interface, [=]() { m_interface->sendMessage(message); }); QMetaObject::invokeMethod(m_interface, [this, message] { m_interface->sendMessage(message); });
} }
void resetBuffer() void resetBuffer()
{ {

View File

@@ -1135,10 +1135,8 @@ public:
group->layout()->addWidget(editor->widget()); group->layout()->addWidget(editor->widget());
layout->addWidget(group); layout->addWidget(group);
connect(editor->editorWidget()->textDocument(), connect(editor->editorWidget()->textDocument(), &TextEditor::TextDocument::contentsChanged,
&TextEditor::TextDocument::contentsChanged, this, [this, editor] { m_settings.setJson(editor->document()->contents()); });
this,
[=] { m_settings.setJson(editor->document()->contents()); });
} }
private: private:

View File

@@ -114,9 +114,9 @@ void PySideInstaller::installPyside(const FilePath &python,
auto install = new PipInstallTask(python); auto install = new PipInstallTask(python);
connect(install, &PipInstallTask::finished, install, &QObject::deleteLater); connect(install, &PipInstallTask::finished, install, &QObject::deleteLater);
connect(install, &PipInstallTask::finished, this, [=](bool success){ connect(install, &PipInstallTask::finished, this, [this, python, pySide](bool success) {
if (success) if (success)
emit this->pySideInstalled(python, pySide); emit pySideInstalled(python, pySide);
}); });
if (availablePySides.isEmpty()) { if (availablePySides.isEmpty()) {
install->setPackages({PipPackage(pySide)}); install->setPackages({PipPackage(pySide)});
@@ -184,7 +184,7 @@ void PySideInstaller::handlePySideMissing(const FilePath &python,
const QString message = Tr::tr("%1 installation missing for %2 (%3)") const QString message = Tr::tr("%1 installation missing for %2 (%3)")
.arg(pySide, pythonName(python), python.toUserOutput()); .arg(pySide, pythonName(python), python.toUserOutput());
InfoBarEntry info(installPySideInfoBarId, message, InfoBarEntry::GlobalSuppression::Enabled); InfoBarEntry info(installPySideInfoBarId, message, InfoBarEntry::GlobalSuppression::Enabled);
auto installCallback = [=] { this->installPyside(python, pySide, document); }; auto installCallback = [this, python, pySide, document] { installPyside(python, pySide, document); };
const QString installTooltip = Tr::tr("Install %1 for %2 using pip package installer.") const QString installTooltip = Tr::tr("Install %1 for %2 using pip package installer.")
.arg(pySide, python.toUserOutput()); .arg(pySide, python.toUserOutput());
info.addCustomButton(Tr::tr("Install"), installCallback, installTooltip); info.addCustomButton(Tr::tr("Install"), installCallback, installTooltip);
@@ -204,10 +204,8 @@ void PySideInstaller::runPySideChecker(const FilePath &python,
if (watcher) if (watcher)
watcher->cancel(); watcher->cancel();
}); });
connect(watcher, connect(watcher, &CheckPySideWatcher::resultReadyAt, this,
&CheckPySideWatcher::resultReadyAt, [this, watcher, python, pySide, document = QPointer<TextEditor::TextDocument>(document)] {
this,
[=, document = QPointer<TextEditor::TextDocument>(document)]() {
if (watcher->result()) if (watcher->result())
handlePySideMissing(python, pySide, document); handlePySideMissing(python, pySide, document);
}); });

View File

@@ -103,8 +103,9 @@ void PySideBuildStep::checkForPySide(const FilePath &python, const QString &pySi
const PipPackage package(pySidePackageName); const PipPackage package(pySidePackageName);
QObject::disconnect(m_watcherConnection); QObject::disconnect(m_watcherConnection);
m_watcher.reset(new QFutureWatcher<PipPackageInfo>()); m_watcher.reset(new QFutureWatcher<PipPackageInfo>());
m_watcherConnection = QObject::connect(m_watcher.get(), &QFutureWatcherBase::finished, this, [=] { m_watcherConnection = QObject::connect(m_watcher.get(), &QFutureWatcherBase::finished, this,
this->handlePySidePackageInfo(m_watcher->result(), python, pySidePackageName); [this, python, pySidePackageName] {
handlePySidePackageInfo(m_watcher->result(), python, pySidePackageName);
}); });
const auto future = Pip::instance(python)->info(package); const auto future = Pip::instance(python)->info(package);
m_watcher->setFuture(future); m_watcher->setFuture(future);

View File

@@ -283,7 +283,8 @@ void PyLSConfigureAssistant::installPythonLanguageServer(const FilePath &python,
auto install = new PipInstallTask(python); auto install = new PipInstallTask(python);
connect(install, &PipInstallTask::finished, this, [=](const bool success) { connect(install, &PipInstallTask::finished, this,
[this, python, document, install](const bool success) {
const QList<TextEditor::TextDocument *> additionalDocuments = m_infoBarEntries.take(python); const QList<TextEditor::TextDocument *> additionalDocuments = m_infoBarEntries.take(python);
if (success) { if (success) {
if (PyLSClient *client = clientForPython(python)) { if (PyLSClient *client = clientForPython(python)) {
@@ -323,10 +324,8 @@ void PyLSConfigureAssistant::openDocument(const FilePath &python, TextEditor::Te
} }
}); });
connect(watcher, connect(watcher, &CheckPylsWatcher::resultReadyAt, this,
&CheckPylsWatcher::resultReadyAt, [this, watcher, python, document = QPointer<TextEditor::TextDocument>(document)] {
this,
[=, document = QPointer<TextEditor::TextDocument>(document)]() {
if (!document || !watcher) if (!document || !watcher)
return; return;
handlePyLSState(python, watcher->result(), document); handlePyLSState(python, watcher->result(), document);
@@ -355,8 +354,8 @@ void PyLSConfigureAssistant::handlePyLSState(const FilePath &python,
Utils::InfoBarEntry info(installPylsInfoBarId, Utils::InfoBarEntry info(installPylsInfoBarId,
message, message,
Utils::InfoBarEntry::GlobalSuppression::Enabled); Utils::InfoBarEntry::GlobalSuppression::Enabled);
info.addCustomButton(Tr::tr("Install"), [=]() { info.addCustomButton(Tr::tr("Install"), [this, python, document, state] {
this->installPythonLanguageServer(python, document, state.pylsModulePath); installPythonLanguageServer(python, document, state.pylsModulePath);
}); });
infoBar->addInfo(info); infoBar->addInfo(info);
m_infoBarEntries[python] << document; m_infoBarEntries[python] << document;

View File

@@ -346,16 +346,16 @@ void MainWidget::init()
// Connect alignment change // Connect alignment change
alignToolButton->setProperty("currentAlignment", ActionAlignLeft); alignToolButton->setProperty("currentAlignment", ActionAlignLeft);
connect(alignToolButton, &QToolButton::clicked, this, [=] { connect(alignToolButton, &QToolButton::clicked, this, [this, alignToolButton] {
StateView *view = this->m_views.last(); StateView *view = m_views.last();
if (view) if (view)
view->scene()->alignStates(alignToolButton->property("currentAlignment").toInt()); view->scene()->alignStates(alignToolButton->property("currentAlignment").toInt());
}); });
// Connect alignment change // Connect alignment change
adjustToolButton->setProperty("currentAdjustment", ActionAdjustWidth); adjustToolButton->setProperty("currentAdjustment", ActionAdjustWidth);
connect(adjustToolButton, &QToolButton::clicked, this, [=] { connect(adjustToolButton, &QToolButton::clicked, this, [this, adjustToolButton] {
StateView *view = this->m_views.last(); StateView *view = m_views.last();
if (view) if (view)
view->scene()->adjustStates(adjustToolButton->property("currentAdjustment").toInt()); view->scene()->adjustStates(adjustToolButton->property("currentAdjustment").toInt());
}); });
@@ -479,7 +479,7 @@ void MainWidget::addStateView(BaseItem *item)
view->scene()->setWarningModel(m_errorPane->warningModel()); view->scene()->setWarningModel(m_errorPane->warningModel());
view->setUiFactory(m_uiFactory); view->setUiFactory(m_uiFactory);
connect(view, &QObject::destroyed, this, [=] { connect(view, &QObject::destroyed, this, [this, view] {
// TODO: un-lambdafy // TODO: un-lambdafy
m_views.removeAll(view); m_views.removeAll(view);
m_document->popRootTag(); m_document->popRootTag();

View File

@@ -42,12 +42,12 @@ PaneTitleButton::PaneTitleButton(OutputPane *pane, QWidget *parent)
} }
}); });
connect(pane, &OutputPane::titleChanged, this, [=] { connect(pane, &OutputPane::titleChanged, this, [this, pane] {
this->setText(pane->title()); setText(pane->title());
}); });
connect(pane, &OutputPane::iconChanged, this, [=] { connect(pane, &OutputPane::iconChanged, this, [this, pane] {
this->setIcon(pane->icon()); setIcon(pane->icon());
}); });
} }

View File

@@ -186,7 +186,7 @@ Warning *WarningModel::createWarning(Warning::Severity severity, const QString &
beginInsertRows(QModelIndex(), m_warnings.count(), m_warnings.count()); beginInsertRows(QModelIndex(), m_warnings.count(), m_warnings.count());
auto warning = new Warning(severity, type, reason, description, m_warningVisibilities.value(severity, true)); auto warning = new Warning(severity, type, reason, description, m_warningVisibilities.value(severity, true));
connect(warning, &Warning::destroyed, this, &WarningModel::warningDestroyed); connect(warning, &Warning::destroyed, this, &WarningModel::warningDestroyed);
connect(warning, &Warning::dataChanged, this, [=] { connect(warning, &Warning::dataChanged, this, [this, warning] {
emit warningsChanged(); emit warningsChanged();
QModelIndex ind = createIndex(m_warnings.indexOf(warning), 0); QModelIndex ind = createIndex(m_warnings.indexOf(warning), 0);
emit dataChanged(ind, ind); emit dataChanged(ind, ind);

View File

@@ -413,12 +413,9 @@ void VcsBaseClient::log(const FilePath &workingDir,
if (editorConfig) { if (editorConfig) {
editorConfig->setBaseArguments(extraOptions); editorConfig->setBaseArguments(extraOptions);
// editor has been just created, createVcsEditor() didn't set a configuration widget yet // editor has been just created, createVcsEditor() didn't set a configuration widget yet
connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, this, [=] { connect(editorConfig, &VcsBaseEditorConfig::commandExecutionRequested, this,
this->log(workingDir, [this, workingDir, files, extraOptions, enableAnnotationContextMenu, addAuthOptions] {
files, log(workingDir, files, extraOptions, enableAnnotationContextMenu, addAuthOptions);
extraOptions,
enableAnnotationContextMenu,
addAuthOptions);
}); });
editor->setEditorConfig(editorConfig); editor->setEditorConfig(editorConfig);
} }