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))
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.
}
@@ -975,7 +975,7 @@ void PluginManagerPrivate::startDelayedInitialize()
const QString info = QString("Successfully started scenario \"%1\"...").arg(d->m_requestedScenario);
qInfo("%s", qPrintable(info));
} else {
QMetaObject::invokeMethod(this, []() { emit m_instance->scenarioFinished(1); });
QMetaObject::invokeMethod(this, [] { emit m_instance->scenarioFinished(1); });
}
}
#endif
@@ -1304,7 +1304,7 @@ void PluginManagerPrivate::startTests()
failedTests += executeTestPlan(testPlan);
}
QTimer::singleShot(0, this, [failedTests]() { emit m_instance->testsFinished(failedTests); });
QTimer::singleShot(0, this, [failedTests] { emit m_instance->testsFinished(failedTests); });
}
#endif

View File

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

View File

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

View File

@@ -99,7 +99,7 @@ void TimelineAbstractRenderer::setModel(TimelineModel *model)
this, &TimelineAbstractRenderer::setRowHeightsDirty);
connect(d->model, &TimelineModel::contentChanged,
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.
Q_ASSERT(d->model.isNull());
d->renderPasses.clear();
@@ -135,7 +135,7 @@ void TimelineAbstractRenderer::setNotes(TimelineNotesModel *notes)
if (d->notes) {
connect(d->notes, &TimelineNotesModel::changed,
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.
Q_ASSERT(d->notes.isNull());
setNotesDirty();
@@ -164,7 +164,7 @@ void TimelineAbstractRenderer::setZoomer(TimelineZoomControl *zoomer)
d->zoomer = zoomer;
if (d->zoomer) {
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.
Q_ASSERT(d->zoomer.isNull());
emit zoomerChanged(d->zoomer);

View File

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

View File

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

View File

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

View File

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