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) {
async.setConcurrentCallData(localRead, m_filePath);
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));
});
};

View File

@@ -2122,7 +2122,7 @@ void ProcessPrivate::setupDebugLog()
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();
setProperty(QTC_PROCESS_STARTTIME, msNow);
@@ -2135,7 +2135,7 @@ void ProcessPrivate::setupDebugLog()
setProperty(QTC_PROCESS_NUMBER, currentNumber);
});
connect(q, &Process::done, this, [=] {
connect(q, &Process::done, this, [this, now] {
if (!m_process.get())
return;
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);
setWidget(detailsPanel);
connect(toolPanel, &DriverSelectorToolPanel::clicked, this, [=]() {
connect(toolPanel, &DriverSelectorToolPanel::clicked, this, [=] {
DriverSelectionDialog dialog(m_toolsIniFile, supportedDrivers, this);
const int result = dialog.exec();
if (result != QDialog::Accepted)

View File

@@ -96,7 +96,7 @@ FilterDialog::FilterDialog(const Checks &checks, QWidget *parent)
}.attachTo(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);
});

View File

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

View File

@@ -238,7 +238,7 @@ GitDiffEditorController::GitDiffEditorController(IDocument *document,
{
const Storage<QString> diffInputStorage;
const auto onDiffSetup = [=](Process &process) {
const auto onDiffSetup = [this, leftCommit, rightCommit, extraArgs](Process &process) {
process.setCodec(VcsBaseEditor::getCodec(workingDirectory(), {}));
setupCommand(process, {addConfigurationArguments(diffArgs(leftCommit, rightCommit, extraArgs))});
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)
{
const auto commandHandler = [=](const CommandResult &result) {
const auto commandHandler = [this, workingDirectory, pushArgs](const CommandResult &result) {
QString pushFallbackCommand;
const PushFailure pushFailure = handleError(result.cleanedStdErr(),
&pushFallbackCommand);

View File

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

View File

@@ -55,7 +55,7 @@ MercurialDiffEditorController::MercurialDiffEditorController(IDocument *document
const Storage<QString> diffInputStorage;
const auto onDiffSetup = [=](Process &process) {
const auto onDiffSetup = [this, args](Process &process) {
setupCommand(process, {addConfigurationArguments(args)});
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, this, [=](bool success){
if (success)
emit pySideInstalled(python, pySide);
emit this->pySideInstalled(python, pySide);
});
if (availablePySides.isEmpty()) {
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)")
.arg(pySide, pythonName(python), python.toUserOutput());
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.")
.arg(pySide, python.toUserOutput());
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);
m_watcher.reset(new QFutureWatcher<PipPackageInfo>());
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);
m_watcher->setFuture(future);
@@ -258,7 +258,7 @@ PythonBuildConfiguration::PythonBuildConfiguration(Target *target, const Id &id)
this,
&PythonBuildConfiguration::handlePythonUpdated);
auto update = [this]() {
auto update = [this] {
if (isActive()) {
m_buildSystem->emitBuildSystemUpdated();
const FilePaths files = project()->files(Project::AllFiles);

View File

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

View File

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

View File

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

View File

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