Libs: Cleanup lambdas

Change-Id: I715a124dd73f23c735dde27d3205ac7613ae04c6
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-12-12 12:12:36 +01:00
parent d81b4c3aff
commit 24397509d4
8 changed files with 18 additions and 18 deletions

View File

@@ -864,7 +864,7 @@ bool PluginManager::finishScenario()
if (d->m_isScenarioFinished.exchange(true)) if (d->m_isScenarioFinished.exchange(true))
return false; // Finish was already called before. We return false, as we didn't finish it right now. return false; // Finish was already called before. We return false, as we didn't finish it right now.
QMetaObject::invokeMethod(d, []() { emit m_instance->scenarioFinished(0); }); QMetaObject::invokeMethod(d, [] { emit m_instance->scenarioFinished(0); });
return true; // Finished successfully. return true; // Finished successfully.
} }
@@ -975,7 +975,7 @@ void PluginManagerPrivate::startDelayedInitialize()
const QString info = QString("Successfully started scenario \"%1\"...").arg(d->m_requestedScenario); const QString info = QString("Successfully started scenario \"%1\"...").arg(d->m_requestedScenario);
qInfo("%s", qPrintable(info)); qInfo("%s", qPrintable(info));
} else { } else {
QMetaObject::invokeMethod(this, []() { emit m_instance->scenarioFinished(1); }); QMetaObject::invokeMethod(this, [] { emit m_instance->scenarioFinished(1); });
} }
} }
#endif #endif
@@ -1304,7 +1304,7 @@ void PluginManagerPrivate::startTests()
failedTests += executeTestPlan(testPlan); failedTests += executeTestPlan(testPlan);
} }
QTimer::singleShot(0, this, [failedTests]() { emit m_instance->testsFinished(failedTests); }); QTimer::singleShot(0, this, [failedTests] { emit m_instance->testsFinished(failedTests); });
} }
#endif #endif

View File

@@ -76,7 +76,7 @@ void QmlEngineControlClient::messageReceived(const QByteArray &data)
switch (message) { switch (message) {
case EngineAboutToBeAdded: case EngineAboutToBeAdded:
handleWaiting(StartWaitingEngine, [&](){ handleWaiting(StartWaitingEngine, [this, id, name] {
emit engineAboutToBeAdded(id, name); emit engineAboutToBeAdded(id, name);
}); });
break; break;
@@ -84,7 +84,7 @@ void QmlEngineControlClient::messageReceived(const QByteArray &data)
emit engineAdded(id, name); emit engineAdded(id, name);
break; break;
case EngineAboutToBeRemoved: case EngineAboutToBeRemoved:
handleWaiting(StopWaitingEngine, [&](){ handleWaiting(StopWaitingEngine, [this, id, name] {
emit engineAboutToBeRemoved(id, name); emit engineAboutToBeRemoved(id, name);
}); });
break; break;

View File

@@ -541,7 +541,7 @@ bool Scanner::isKeyword(const QString &text) const
QStringList Scanner::keywords() QStringList Scanner::keywords()
{ {
static QStringList words = []() { static QStringList words = [] {
QStringList res; QStringList res;
for (const QString *word = begin(js_keywords); word != end(js_keywords); ++word) for (const QString *word = begin(js_keywords); word != end(js_keywords); ++word)
res.append(*word); res.append(*word);

View File

@@ -99,7 +99,7 @@ void TimelineAbstractRenderer::setModel(TimelineModel *model)
this, &TimelineAbstractRenderer::setRowHeightsDirty); this, &TimelineAbstractRenderer::setRowHeightsDirty);
connect(d->model, &TimelineModel::contentChanged, connect(d->model, &TimelineModel::contentChanged,
this, &TimelineAbstractRenderer::setModelDirty); this, &TimelineAbstractRenderer::setModelDirty);
connect(d->model, &QObject::destroyed, this, [this, d]() { connect(d->model, &QObject::destroyed, this, [this, d] {
// Weak pointers are supposed to be notified before the destroyed() signal is sent. // Weak pointers are supposed to be notified before the destroyed() signal is sent.
Q_ASSERT(d->model.isNull()); Q_ASSERT(d->model.isNull());
d->renderPasses.clear(); d->renderPasses.clear();
@@ -135,7 +135,7 @@ void TimelineAbstractRenderer::setNotes(TimelineNotesModel *notes)
if (d->notes) { if (d->notes) {
connect(d->notes, &TimelineNotesModel::changed, connect(d->notes, &TimelineNotesModel::changed,
this, &TimelineAbstractRenderer::setNotesDirty); this, &TimelineAbstractRenderer::setNotesDirty);
connect(d->notes, &QObject::destroyed, this, [this, d]() { connect(d->notes, &QObject::destroyed, this, [this, d] {
// Weak pointers are supposed to be notified before the destroyed() signal is sent. // Weak pointers are supposed to be notified before the destroyed() signal is sent.
Q_ASSERT(d->notes.isNull()); Q_ASSERT(d->notes.isNull());
setNotesDirty(); setNotesDirty();
@@ -164,7 +164,7 @@ void TimelineAbstractRenderer::setZoomer(TimelineZoomControl *zoomer)
d->zoomer = zoomer; d->zoomer = zoomer;
if (d->zoomer) { if (d->zoomer) {
connect(d->zoomer, &TimelineZoomControl::windowChanged, this, &QQuickItem::update); connect(d->zoomer, &TimelineZoomControl::windowChanged, this, &QQuickItem::update);
connect(d->zoomer, &QObject::destroyed, this, [this, d]() { connect(d->zoomer, &QObject::destroyed, this, [this, d] {
// Weak pointers are supposed to be notified before the destroyed() signal is sent. // Weak pointers are supposed to be notified before the destroyed() signal is sent.
Q_ASSERT(d->zoomer.isNull()); Q_ASSERT(d->zoomer.isNull());
emit zoomerChanged(d->zoomer); emit zoomerChanged(d->zoomer);

View File

@@ -1158,7 +1158,7 @@ void StringAspect::addToLayout(LayoutItem &parent)
connect(d->m_checkerImpl.m_checked.get(), connect(d->m_checkerImpl.m_checked.get(),
&BoolAspect::volatileValueChanged, &BoolAspect::volatileValueChanged,
lineEditDisplay, lineEditDisplay,
[this, lineEditDisplay]() { [this, lineEditDisplay] {
d->m_checkerImpl.updateWidgetFromCheckStatus(this, lineEditDisplay); d->m_checkerImpl.updateWidgetFromCheckStatus(this, lineEditDisplay);
}); });
} }
@@ -1185,12 +1185,12 @@ void StringAspect::addToLayout(LayoutItem &parent)
connect(lineEditDisplay, connect(lineEditDisplay,
&FancyLineEdit::editingFinished, &FancyLineEdit::editingFinished,
this, this,
[this, lineEditDisplay]() { [this, lineEditDisplay] {
d->undoable.set(undoStack(), lineEditDisplay->text()); d->undoable.set(undoStack(), lineEditDisplay->text());
handleGuiChanged(); handleGuiChanged();
}); });
} else { } else {
connect(lineEditDisplay, &QLineEdit::textChanged, this, [this, lineEditDisplay]() { connect(lineEditDisplay, &QLineEdit::textChanged, this, [this, lineEditDisplay] {
d->undoable.set(undoStack(), lineEditDisplay->text()); d->undoable.set(undoStack(), lineEditDisplay->text());
handleGuiChanged(); handleGuiChanged();
}); });
@@ -1235,7 +1235,7 @@ void StringAspect::addToLayout(LayoutItem &parent)
connect(d->m_checkerImpl.m_checked.get(), connect(d->m_checkerImpl.m_checked.get(),
&BoolAspect::volatileValueChanged, &BoolAspect::volatileValueChanged,
textEditDisplay, textEditDisplay,
[this, textEditDisplay]() { [this, textEditDisplay] {
d->m_checkerImpl.updateWidgetFromCheckStatus(this, textEditDisplay); d->m_checkerImpl.updateWidgetFromCheckStatus(this, textEditDisplay);
}); });
} }
@@ -1252,7 +1252,7 @@ void StringAspect::addToLayout(LayoutItem &parent)
textEditDisplay, textEditDisplay,
&QTextEdit::setPlaceholderText); &QTextEdit::setPlaceholderText);
connect(textEditDisplay, &QTextEdit::textChanged, this, [this, textEditDisplay]() { connect(textEditDisplay, &QTextEdit::textChanged, this, [this, textEditDisplay] {
if (textEditDisplay->toPlainText() != d->undoable.get()) { if (textEditDisplay->toPlainText() != d->undoable.get()) {
d->undoable.set(undoStack(), textEditDisplay->toPlainText()); d->undoable.set(undoStack(), textEditDisplay->toPlainText());
handleGuiChanged(); handleGuiChanged();
@@ -3549,7 +3549,7 @@ void StringSelectionAspect::addToLayout(Layouting::LayoutItem &parent)
bufferToGui(); bufferToGui();
}); });
connect(&m_undoable.m_signal, &UndoSignaller::changed, comboBox, [this, comboBox]() { connect(&m_undoable.m_signal, &UndoSignaller::changed, comboBox, [this, comboBox] {
auto item = itemById(m_undoable.get()); auto item = itemById(m_undoable.get());
if (item) if (item)
m_selectionModel->setCurrentIndex(item->index(), QItemSelectionModel::ClearAndSelect); m_selectionModel->setCurrentIndex(item->index(), QItemSelectionModel::ClearAndSelect);

View File

@@ -232,7 +232,7 @@ expected_str<void> DeviceFileAccess::copyRecursively(const FilePath &src,
QObject::connect(&srcProcess, QObject::connect(&srcProcess,
&Process::readyReadStandardOutput, &Process::readyReadStandardOutput,
&targetProcess, &targetProcess,
[&srcProcess, &targetProcess]() { [&srcProcess, &targetProcess] {
targetProcess.writeRaw(srcProcess.readAllRawStandardOutput()); targetProcess.writeRaw(srcProcess.readAllRawStandardOutput());
}); });

View File

@@ -571,7 +571,7 @@ void FancyLineEdit::validate()
connect(d->m_validatorWatcher.get(), connect(d->m_validatorWatcher.get(),
&QFutureWatcher<AsyncValidationResult>::finished, &QFutureWatcher<AsyncValidationResult>::finished,
this, this,
[this, oldText]() { [this, oldText] {
FancyLineEdit::AsyncValidationResult result = d->m_validatorWatcher->result(); FancyLineEdit::AsyncValidationResult result = d->m_validatorWatcher->result();
handleValidationResult(result, oldText); handleValidationResult(result, oldText);

View File

@@ -42,7 +42,7 @@ public:
FilePath{}), FilePath{}),
parameters.environment.value_or(Environment{})); parameters.environment.value_or(Environment{}));
}; };
auto createProcessInterface = []() { return new ExternalTerminalProcessImpl(); }; auto createProcessInterface = [] { return new ExternalTerminalProcessImpl; };
addCallbackSet("External", {openTerminal, createProcessInterface}); addCallbackSet("External", {openTerminal, createProcessInterface});
} }