aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJarek Kobus <[email protected]>2022-12-07 14:34:32 +0100
committerJarek Kobus <[email protected]>2022-12-07 15:28:47 +0000
commit9afcf870a1f6f4d498621dc3fb0c5bb94e03d773 (patch)
tree57e0f807a2c54476efc71dea49f956af09f62492 /src
parent166f710e621e65c49dd79751ad5083183e3c5459 (diff)
Utils: Pass context object to lambda connections
Remove some unneeded lambda () brackets. Change-Id: I6b7e07cad8a240a7021c6ddacc84a971809ee717 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Eike Ziller <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/libs/utils/delegates.cpp2
-rw-r--r--src/libs/utils/deviceshell.cpp2
-rw-r--r--src/libs/utils/executeondestruction.h2
-rw-r--r--src/libs/utils/fancymainwindow.cpp2
-rw-r--r--src/libs/utils/infobar.cpp6
-rw-r--r--src/libs/utils/launcherinterface.cpp2
-rw-r--r--src/libs/utils/macroexpander.cpp2
-rw-r--r--src/libs/utils/mapreduce.h2
-rw-r--r--src/libs/utils/minimizableinfobars.cpp2
-rw-r--r--src/libs/utils/namevaluevalidator.cpp2
-rw-r--r--src/libs/utils/progressindicator.cpp2
-rw-r--r--src/libs/utils/runextensions.h6
-rw-r--r--src/libs/utils/variablechooser.cpp2
-rw-r--r--src/libs/utils/wizardpage.h2
14 files changed, 18 insertions, 18 deletions
diff --git a/src/libs/utils/delegates.cpp b/src/libs/utils/delegates.cpp
index 3e847b31db8..beb4190e232 100644
--- a/src/libs/utils/delegates.cpp
+++ b/src/libs/utils/delegates.cpp
@@ -119,7 +119,7 @@ QWidget *PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionVi
editor->setAutoFillBackground(true); // To hide the text beneath the editor widget
editor->lineEdit()->setMinimumWidth(0);
- connect(editor, &PathChooser::browsingFinished, this, [this, editor]() {
+ connect(editor, &PathChooser::browsingFinished, this, [this, editor] {
emit const_cast<PathChooserDelegate*>(this)->commitData(editor);
});
diff --git a/src/libs/utils/deviceshell.cpp b/src/libs/utils/deviceshell.cpp
index dd0abd107cf..71db1b4b261 100644
--- a/src/libs/utils/deviceshell.cpp
+++ b/src/libs/utils/deviceshell.cpp
@@ -108,7 +108,7 @@ RunResult DeviceShell::run(const CommandLine &cmd, const QByteArray &stdInData)
const int id = ++m_currentId;
const auto it = m_commandOutput.insert(id, CommandRun{{-1, {}, {}}, &waiter});
- QMetaObject::invokeMethod(m_shellProcess.get(), [this, id, cmd, stdInData]() {
+ QMetaObject::invokeMethod(m_shellProcess.get(), [this, id, cmd, stdInData] {
const QString command = QString("%1 \"%2\" %3\n")
.arg(id)
.arg(QString::fromLatin1(stdInData.toBase64()))
diff --git a/src/libs/utils/executeondestruction.h b/src/libs/utils/executeondestruction.h
index 7fbfecd39e1..880fae4e612 100644
--- a/src/libs/utils/executeondestruction.h
+++ b/src/libs/utils/executeondestruction.h
@@ -10,7 +10,7 @@ namespace Utils {
class ExecuteOnDestruction
{
public:
- ExecuteOnDestruction() noexcept : destructionCode([](){}) {}
+ ExecuteOnDestruction() noexcept : destructionCode([] {}) {}
ExecuteOnDestruction(std::function<void()> code) : destructionCode(std::move(code)) {}
~ExecuteOnDestruction() { if (destructionCode) destructionCode(); }
diff --git a/src/libs/utils/fancymainwindow.cpp b/src/libs/utils/fancymainwindow.cpp
index 92772bd085e..cba540eb2c0 100644
--- a/src/libs/utils/fancymainwindow.cpp
+++ b/src/libs/utils/fancymainwindow.cpp
@@ -248,7 +248,7 @@ DockWidget::DockWidget(QWidget *inner, FancyMainWindow *parent, bool immutable)
connect(&m_timer, &QTimer::timeout, this, &DockWidget::handleMouseTimeout);
connect(this, &QDockWidget::topLevelChanged, this, &DockWidget::handleToplevelChanged);
- connect(toggleViewAction(), &QAction::triggered, [this] {
+ connect(toggleViewAction(), &QAction::triggered, this, [this] {
if (isVisible())
raise();
});
diff --git a/src/libs/utils/infobar.cpp b/src/libs/utils/infobar.cpp
index afb25a1095d..f42dba694e0 100644
--- a/src/libs/utils/infobar.cpp
+++ b/src/libs/utils/infobar.cpp
@@ -300,7 +300,7 @@ void InfoBarDisplay::update()
showDetailsButton->setCheckable(true);
showDetailsButton->setChecked(m_isShowingDetailsWidget);
showDetailsButton->setText(tr("&Show Details"));
- connect(showDetailsButton, &QToolButton::clicked, [this, vbox, info] (bool) {
+ connect(showDetailsButton, &QToolButton::clicked, this, [this, vbox, info] (bool) {
QWidget *detailsWidget = vbox->count() == 2 ? vbox->itemAt(1)->widget() : nullptr;
if (!detailsWidget) {
detailsWidget = info.m_detailsWidgetCreator();
@@ -323,7 +323,7 @@ void InfoBarDisplay::update()
cb->addItem(comboInfo.displayText, comboInfo.data);
if (info.m_combo.currentIndex >= 0 && info.m_combo.currentIndex < cb->count())
cb->setCurrentIndex(info.m_combo.currentIndex);
- connect(cb, &QComboBox::currentIndexChanged, this, [cb, info]() {
+ connect(cb, &QComboBox::currentIndexChanged, this, [cb, info] {
info.m_combo.callback({cb->currentText(), cb->currentData()});
}, Qt::QueuedConnection);
@@ -334,7 +334,7 @@ void InfoBarDisplay::update()
auto infoWidgetButton = new QToolButton;
infoWidgetButton->setText(button.text);
infoWidgetButton->setToolTip(button.tooltip);
- connect(infoWidgetButton, &QAbstractButton::clicked, [button]() { button.callback(); });
+ connect(infoWidgetButton, &QAbstractButton::clicked, [button] { button.callback(); });
hbox->addWidget(infoWidgetButton);
}
diff --git a/src/libs/utils/launcherinterface.cpp b/src/libs/utils/launcherinterface.cpp
index a38bca2693f..9524aad0ac5 100644
--- a/src/libs/utils/launcherinterface.cpp
+++ b/src/libs/utils/launcherinterface.cpp
@@ -160,7 +160,7 @@ LauncherInterface::LauncherInterface()
m_private->setPathToLauncher(s_pathToLauncher);
const FilePath launcherFilePath = FilePath::fromString(m_private->launcherFilePath())
.cleanPath().withExecutableSuffix();
- auto launcherIsNotExecutable = [&launcherFilePath]() {
+ auto launcherIsNotExecutable = [&launcherFilePath] {
qWarning() << "The Creator's process launcher"
<< launcherFilePath << "is not executable.";
};
diff --git a/src/libs/utils/macroexpander.cpp b/src/libs/utils/macroexpander.cpp
index 0b238c639e9..b3c9255b5ad 100644
--- a/src/libs/utils/macroexpander.cpp
+++ b/src/libs/utils/macroexpander.cpp
@@ -360,7 +360,7 @@ void MacroExpander::registerIntVariable(const QByteArray &variable,
{
const MacroExpander::IntFunction valuecopy = value; // do not capture a reference in a lambda
registerVariable(variable, description,
- [valuecopy]() { return QString::number(valuecopy ? valuecopy() : 0); });
+ [valuecopy] { return QString::number(valuecopy ? valuecopy() : 0); });
}
/*!
diff --git a/src/libs/utils/mapreduce.h b/src/libs/utils/mapreduce.h
index 57d1a578902..1c58c690f9a 100644
--- a/src/libs/utils/mapreduce.h
+++ b/src/libs/utils/mapreduce.h
@@ -77,7 +77,7 @@ protected:
&& m_mapWatcher.size() < std::max(m_threadPool->maxThreadCount(), 1)) {
didSchedule = true;
auto watcher = new QFutureWatcher<MapResult>();
- connect(watcher, &QFutureWatcher<MapResult>::finished, this, [this, watcher]() {
+ connect(watcher, &QFutureWatcher<MapResult>::finished, this, [this, watcher] {
mapFinished(watcher);
});
if (m_handleProgress) {
diff --git a/src/libs/utils/minimizableinfobars.cpp b/src/libs/utils/minimizableinfobars.cpp
index 6ca39a4af2a..050f77dc782 100644
--- a/src/libs/utils/minimizableinfobars.cpp
+++ b/src/libs/utils/minimizableinfobars.cpp
@@ -45,7 +45,7 @@ void MinimizableInfoBars::createActions()
auto action = new QAction(this);
action->setToolTip(entry.text());
action->setIcon(Icons::WARNING_TOOLBAR.pixmap());
- connect(action, &QAction::triggered, this, [this, id]() {
+ connect(action, &QAction::triggered, this, [this, id] {
setShowInInfoBar(id, true);
updateInfo(id);
});
diff --git a/src/libs/utils/namevaluevalidator.cpp b/src/libs/utils/namevaluevalidator.cpp
index d2a72f1d309..778d52cc9fa 100644
--- a/src/libs/utils/namevaluevalidator.cpp
+++ b/src/libs/utils/namevaluevalidator.cpp
@@ -22,7 +22,7 @@ NameValueValidator::NameValueValidator(QWidget *parent,
{
m_hideTipTimer.setInterval(2000);
m_hideTipTimer.setSingleShot(true);
- connect(&m_hideTipTimer, &QTimer::timeout, this, []() { ToolTip::hide(); });
+ connect(&m_hideTipTimer, &QTimer::timeout, this, [] { ToolTip::hide(); });
}
QValidator::State NameValueValidator::validate(QString &in, int &pos) const
diff --git a/src/libs/utils/progressindicator.cpp b/src/libs/utils/progressindicator.cpp
index e41f7793111..31576066c2d 100644
--- a/src/libs/utils/progressindicator.cpp
+++ b/src/libs/utils/progressindicator.cpp
@@ -72,7 +72,7 @@ static FilePath imageFileNameForIndicatorSize(ProgressIndicatorSize size)
ProgressIndicatorPainter::ProgressIndicatorPainter(ProgressIndicatorSize size)
{
m_timer.setSingleShot(false);
- QObject::connect(&m_timer, &QTimer::timeout, [this] {
+ QObject::connect(&m_timer, &QTimer::timeout, &m_timer, [this] {
nextAnimationStep();
if (m_callback)
m_callback();
diff --git a/src/libs/utils/runextensions.h b/src/libs/utils/runextensions.h
index ba779e131f4..194b977d2cd 100644
--- a/src/libs/utils/runextensions.h
+++ b/src/libs/utils/runextensions.h
@@ -594,7 +594,7 @@ const QFuture<T> &onFinished(const QFuture<T> &future,
QObject::connect(watcher,
&QFutureWatcherBase::finished,
receiver,
- [receiver, member, watcher]() { (receiver->*member)(watcher->future()); });
+ [receiver, member, watcher] { (receiver->*member)(watcher->future()); });
watcher->setFuture(future);
return future;
}
@@ -610,7 +610,7 @@ const QFuture<T> &onFinished(const QFuture<T> &future, QObject *guard, Function
{
auto watcher = new QFutureWatcher<T>();
QObject::connect(watcher, &QFutureWatcherBase::finished, watcher, &QObject::deleteLater);
- QObject::connect(watcher, &QFutureWatcherBase::finished, guard, [f, watcher]() {
+ QObject::connect(watcher, &QFutureWatcherBase::finished, guard, [f, watcher] {
f(watcher->future());
});
watcher->setFuture(future);
@@ -627,7 +627,7 @@ const QFuture<T> &onFinished(const QFuture<T> &future, Function f)
{
auto watcher = new QFutureWatcher<T>();
QObject::connect(watcher, &QFutureWatcherBase::finished, watcher, &QObject::deleteLater);
- QObject::connect(watcher, &QFutureWatcherBase::finished, [f, watcher]() {
+ QObject::connect(watcher, &QFutureWatcherBase::finished, [f, watcher] {
f(watcher->future());
});
watcher->setFuture(future);
diff --git a/src/libs/utils/variablechooser.cpp b/src/libs/utils/variablechooser.cpp
index 725174a61b5..c24cbbdb8ed 100644
--- a/src/libs/utils/variablechooser.cpp
+++ b/src/libs/utils/variablechooser.cpp
@@ -376,7 +376,7 @@ VariableChooser::VariableChooser(QWidget *parent) :
setFocusPolicy(Qt::StrongFocus);
setFocusProxy(d->m_variableTree);
setGeometry(QRect(0, 0, 400, 500));
- addMacroExpanderProvider([]() { return globalMacroExpander(); });
+ addMacroExpanderProvider([] { return globalMacroExpander(); });
}
/*!
diff --git a/src/libs/utils/wizardpage.h b/src/libs/utils/wizardpage.h
index 4ceb59247a1..b13810d7bac 100644
--- a/src/libs/utils/wizardpage.h
+++ b/src/libs/utils/wizardpage.h
@@ -31,7 +31,7 @@ public:
auto widget = new ObjectToFieldWidgetConverter();
widget->toVariantFunction = toVariantFunction;
connect(sender, &QObject::destroyed, widget, &QObject::deleteLater);
- connect(sender, member, widget, [widget]() { emit widget->valueChanged(widget->value()); });
+ connect(sender, member, widget, [widget] { emit widget->valueChanged(widget->value()); });
return widget;
}