Work on lambdas C++20 compatibility

Change-Id: I0d391c02ae1e1c5a1751b33ca7e83902e1cfe269
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Serg Kryvonos
2023-12-07 12:48:05 +01:00
parent b442ca3873
commit c3a7279f05
14 changed files with 28 additions and 26 deletions

View File

@@ -98,7 +98,7 @@ private:
const auto setup = [this](Async<QByteArray> &async) { const auto setup = [this](Async<QByteArray> &async) {
async.setConcurrentCallData(localRead, m_filePath); async.setConcurrentCallData(localRead, m_filePath);
Async<QByteArray> *asyncPtr = &async; Async<QByteArray> *asyncPtr = &async;
connect(asyncPtr, &AsyncBase::resultReadyAt, this, [=](int index) { connect(asyncPtr, &AsyncBase::resultReadyAt, this, [this, asyncPtr](int index) {
emit readyRead(asyncPtr->resultAt(index)); emit readyRead(asyncPtr->resultAt(index));
}); });
}; };

View File

@@ -2122,7 +2122,7 @@ void ProcessPrivate::setupDebugLog()
return duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count(); return duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
}; };
connect(q, &Process::starting, this, [=] { connect(q, &Process::starting, this, [this, now] {
const quint64 msNow = now(); const quint64 msNow = now();
setProperty(QTC_PROCESS_STARTTIME, msNow); setProperty(QTC_PROCESS_STARTTIME, msNow);
@@ -2135,7 +2135,7 @@ void ProcessPrivate::setupDebugLog()
setProperty(QTC_PROCESS_NUMBER, currentNumber); setProperty(QTC_PROCESS_NUMBER, currentNumber);
}); });
connect(q, &Process::done, this, [=] { connect(q, &Process::done, this, [this, now] {
if (!m_process.get()) if (!m_process.get())
return; return;
const QVariant n = property(QTC_PROCESS_NUMBER); const QVariant n = property(QTC_PROCESS_NUMBER);

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, [=] {
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

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

View File

@@ -425,9 +425,11 @@ bool BranchView::checkout()
return false; return false;
} }
const bool moveChanges = branchCheckoutDialog.moveLocalChangesToNextBranch(); const auto commandHandler = [this,
const bool popStash = branchCheckoutDialog.popStashOfNextBranch(); moveChanges = branchCheckoutDialog.moveLocalChangesToNextBranch(),
const auto commandHandler = [=](const CommandResult &) { popStash = branchCheckoutDialog.popStashOfNextBranch(),
popMessageStart
](const CommandResult &) {
if (moveChanges) { if (moveChanges) {
gitClient().endStashScope(m_repository); gitClient().endStashScope(m_repository);
} else if (popStash) { } else if (popStash) {

View File

@@ -238,7 +238,7 @@ GitDiffEditorController::GitDiffEditorController(IDocument *document,
{ {
const Storage<QString> diffInputStorage; const Storage<QString> diffInputStorage;
const auto onDiffSetup = [=](Process &process) { const auto onDiffSetup = [this, leftCommit, rightCommit, extraArgs](Process &process) {
process.setCodec(VcsBaseEditor::getCodec(workingDirectory(), {})); process.setCodec(VcsBaseEditor::getCodec(workingDirectory(), {}));
setupCommand(process, {addConfigurationArguments(diffArgs(leftCommit, rightCommit, extraArgs))}); setupCommand(process, {addConfigurationArguments(diffArgs(leftCommit, rightCommit, extraArgs))});
VcsOutputWindow::appendCommand(process.workingDirectory(), process.commandLine()); VcsOutputWindow::appendCommand(process.workingDirectory(), process.commandLine());
@@ -3148,7 +3148,7 @@ static PushFailure handleError(const QString &text, QString *pushFallbackCommand
void GitClient::push(const FilePath &workingDirectory, const QStringList &pushArgs) void GitClient::push(const FilePath &workingDirectory, const QStringList &pushArgs)
{ {
const auto commandHandler = [=](const CommandResult &result) { const auto commandHandler = [this, workingDirectory, pushArgs](const CommandResult &result) {
QString pushFallbackCommand; QString pushFallbackCommand;
const PushFailure pushFailure = handleError(result.cleanedStdErr(), const PushFailure pushFailure = handleError(result.cleanedStdErr(),
&pushFallbackCommand); &pushFallbackCommand);

View File

@@ -1134,7 +1134,7 @@ public:
connect(editor->editorWidget()->textDocument(), connect(editor->editorWidget()->textDocument(),
&TextEditor::TextDocument::contentsChanged, &TextEditor::TextDocument::contentsChanged,
this, this,
[=]() { m_settings.setJson(editor->document()->contents()); }); [=] { m_settings.setJson(editor->document()->contents()); });
} }
private: private:

View File

@@ -55,7 +55,7 @@ MercurialDiffEditorController::MercurialDiffEditorController(IDocument *document
const Storage<QString> diffInputStorage; const Storage<QString> diffInputStorage;
const auto onDiffSetup = [=](Process &process) { const auto onDiffSetup = [this, args](Process &process) {
setupCommand(process, {addConfigurationArguments(args)}); setupCommand(process, {addConfigurationArguments(args)});
VcsOutputWindow::appendCommand(process.workingDirectory(), process.commandLine()); VcsOutputWindow::appendCommand(process.workingDirectory(), process.commandLine());
}; };

View File

@@ -125,7 +125,7 @@ void PySideInstaller::installPyside(const FilePath &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, [=](bool success){
if (success) if (success)
emit pySideInstalled(python, pySide); emit this->pySideInstalled(python, pySide);
}); });
if (availablePySides.isEmpty()) { if (availablePySides.isEmpty()) {
install->setPackages({PipPackage(pySide)}); install->setPackages({PipPackage(pySide)});
@@ -193,7 +193,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 = [=]() { installPyside(python, pySide, document); }; auto installCallback = [=] { this->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);

View File

@@ -112,7 +112,7 @@ void PySideBuildStep::checkForPySide(const FilePath &python, const QString &pySi
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, [=] {
handlePySidePackageInfo(m_watcher->result(), python, pySidePackageName); this->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);
@@ -258,7 +258,7 @@ PythonBuildConfiguration::PythonBuildConfiguration(Target *target, const Id &id)
this, this,
&PythonBuildConfiguration::handlePythonUpdated); &PythonBuildConfiguration::handlePythonUpdated);
auto update = [this]() { auto update = [this] {
if (isActive()) { if (isActive()) {
m_buildSystem->emitBuildSystemUpdated(); m_buildSystem->emitBuildSystemUpdated();
const FilePaths files = project()->files(Project::AllFiles); const FilePaths files = project()->files(Project::AllFiles);

View File

@@ -354,7 +354,7 @@ void PyLSConfigureAssistant::handlePyLSState(const FilePath &python,
message, message,
Utils::InfoBarEntry::GlobalSuppression::Enabled); Utils::InfoBarEntry::GlobalSuppression::Enabled);
info.addCustomButton(Tr::tr("Install"), [=]() { info.addCustomButton(Tr::tr("Install"), [=]() {
installPythonLanguageServer(python, document, state.pylsModulePath); this->installPythonLanguageServer(python, document, state.pylsModulePath);
}); });
infoBar->addInfo(info); infoBar->addInfo(info);
m_infoBarEntries[python] << document; m_infoBarEntries[python] << document;

View File

@@ -254,18 +254,18 @@ RecordWidget::RecordWidget(const FilePath &recordFile, QWidget *parent)
recordButton->setEnabled(false); recordButton->setEnabled(false);
stopButton->setEnabled(true); stopButton->setEnabled(true);
settingsButton->setEnabled(false); settingsButton->setEnabled(false);
m_openClipAction->setEnabled(false); this->m_openClipAction->setEnabled(false);
emit started(); emit started();
}); });
connect(m_process, &Process::done, this, [=] { connect(m_process, &Process::done, this, [=] {
recordButton->setEnabled(true); recordButton->setEnabled(true);
stopButton->setEnabled(false); stopButton->setEnabled(false);
settingsButton->setEnabled(true); settingsButton->setEnabled(true);
m_openClipAction->setEnabled(true); this->m_openClipAction->setEnabled(true);
if (m_process->exitCode() == 0) if (this->m_process->exitCode() == 0)
emit finished(FFmpegUtils::clipInfo(m_clipInfo.file)); emit finished(FFmpegUtils::clipInfo(this->m_clipInfo.file));
else else
FFmpegUtils::reportError(m_process->commandLine(), m_lastOutputChunk); FFmpegUtils::reportError(this->m_process->commandLine(), this->m_lastOutputChunk);
}); });
connect(m_process, &Process::readyReadStandardError, this, [this, progressLabel] { connect(m_process, &Process::readyReadStandardError, this, [this, progressLabel] {
m_lastOutputChunk = m_process->readAllRawStandardError(); m_lastOutputChunk = m_process->readAllRawStandardError();

View File

@@ -347,7 +347,7 @@ 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, [=] {
StateView *view = m_views.last(); StateView *view = this->m_views.last();
if (view) if (view)
view->scene()->alignStates(alignToolButton->property("currentAlignment").toInt()); view->scene()->alignStates(alignToolButton->property("currentAlignment").toInt());
}); });
@@ -355,7 +355,7 @@ void MainWidget::init()
// Connect alignment change // Connect alignment change
adjustToolButton->setProperty("currentAdjustment", ActionAdjustWidth); adjustToolButton->setProperty("currentAdjustment", ActionAdjustWidth);
connect(adjustToolButton, &QToolButton::clicked, this, [=] { connect(adjustToolButton, &QToolButton::clicked, this, [=] {
StateView *view = m_views.last(); StateView *view = this->m_views.last();
if (view) if (view)
view->scene()->adjustStates(adjustToolButton->property("currentAdjustment").toInt()); view->scene()->adjustStates(adjustToolButton->property("currentAdjustment").toInt());
}); });

View File

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