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

@@ -114,9 +114,9 @@ void PySideInstaller::installPyside(const FilePath &python,
auto install = new PipInstallTask(python);
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)
emit this->pySideInstalled(python, pySide);
emit pySideInstalled(python, pySide);
});
if (availablePySides.isEmpty()) {
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)")
.arg(pySide, pythonName(python), python.toUserOutput());
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.")
.arg(pySide, python.toUserOutput());
info.addCustomButton(Tr::tr("Install"), installCallback, installTooltip);
@@ -204,10 +204,8 @@ void PySideInstaller::runPySideChecker(const FilePath &python,
if (watcher)
watcher->cancel();
});
connect(watcher,
&CheckPySideWatcher::resultReadyAt,
this,
[=, document = QPointer<TextEditor::TextDocument>(document)]() {
connect(watcher, &CheckPySideWatcher::resultReadyAt, this,
[this, watcher, python, pySide, document = QPointer<TextEditor::TextDocument>(document)] {
if (watcher->result())
handlePySideMissing(python, pySide, document);
});

View File

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

View File

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