From 4d7f3863aab48908e2a18131dcee887cbe9df500 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Fri, 19 Apr 2024 17:52:18 +0000 Subject: [PATCH] trivial: avoid relying on implicit capture of `this` when using `=` --- src/qt/appearancewidget.cpp | 10 +++++----- src/qt/bitcoingui.cpp | 8 ++++---- src/qt/optionsdialog.cpp | 6 +++--- src/qt/overviewpage.cpp | 2 +- src/scheduler.cpp | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/qt/appearancewidget.cpp b/src/qt/appearancewidget.cpp index d52c03971a9b01..2a26902d017aac 100644 --- a/src/qt/appearancewidget.cpp +++ b/src/qt/appearancewidget.cpp @@ -46,11 +46,11 @@ AppearanceWidget::AppearanceWidget(QWidget* parent) : connect(ui->fontWeightNormalSlider, &QSlider::valueChanged, [this](auto nValue) { updateFontWeightNormal(nValue); }); connect(ui->fontWeightBoldSlider, &QSlider::valueChanged, [this](auto nValue) { updateFontWeightBold(nValue); }); - connect(ui->theme, &QComboBox::currentTextChanged, [=]() { Q_EMIT appearanceChanged(); }); - connect(ui->fontFamily, &QComboBox::currentTextChanged, [=]() { Q_EMIT appearanceChanged(); }); - connect(ui->fontScaleSlider, &QSlider::sliderReleased, [=]() { Q_EMIT appearanceChanged(); }); - connect(ui->fontWeightNormalSlider, &QSlider::sliderReleased, [=]() { Q_EMIT appearanceChanged(); }); - connect(ui->fontWeightBoldSlider, &QSlider::sliderReleased, [=]() { Q_EMIT appearanceChanged(); }); + connect(ui->theme, &QComboBox::currentTextChanged, [this]() { Q_EMIT appearanceChanged(); }); + connect(ui->fontFamily, &QComboBox::currentTextChanged, [this]() { Q_EMIT appearanceChanged(); }); + connect(ui->fontScaleSlider, &QSlider::sliderReleased, [this]() { Q_EMIT appearanceChanged(); }); + connect(ui->fontWeightNormalSlider, &QSlider::sliderReleased, [this]() { Q_EMIT appearanceChanged(); }); + connect(ui->fontWeightBoldSlider, &QSlider::sliderReleased, [this]() { Q_EMIT appearanceChanged(); }); } AppearanceWidget::~AppearanceWidget() diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 80dbf3b8c1227a..eab3fe39d5911b 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -234,7 +234,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle, bool fDebugCustomStyleSheets = gArgs.GetBoolArg("-debug-ui", false) && GUIUtil::isStyleSheetDirectoryCustom(); if (fDebugCustomStyleSheets) { timerCustomCss = new QTimer(this); - QObject::connect(timerCustomCss, &QTimer::timeout, [=]() { + QObject::connect(timerCustomCss, &QTimer::timeout, [this]() { if (!m_node.shutdownRequested()) { GUIUtil::loadStyleSheet(); } @@ -285,7 +285,7 @@ void BitcoinGUI::startSpinner() }; timerSpinner = new QTimer(this); - QObject::connect(timerSpinner, &QTimer::timeout, [=]() { + QObject::connect(timerSpinner, &QTimer::timeout, [this, &getNextFrame]() { if (timerSpinner == nullptr) { return; } @@ -313,7 +313,7 @@ void BitcoinGUI::startConnectingAnimation() } timerConnecting = new QTimer(this); - QObject::connect(timerConnecting, &QTimer::timeout, [=]() { + QObject::connect(timerConnecting, &QTimer::timeout, [this]() { if (timerConnecting == nullptr) { return; @@ -1311,7 +1311,7 @@ void BitcoinGUI::openOptionsDialogWithTab(OptionsDialog::Tab tab) OptionsDialog dlg(this, enableWallet); dlg.setCurrentTab(tab); dlg.setModel(clientModel->getOptionsModel()); - connect(&dlg, &OptionsDialog::appearanceChanged, [=]() { + connect(&dlg, &OptionsDialog::appearanceChanged, [this]() { updateWidth(); }); dlg.exec(); diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index d5dec22d6bf693..94c7af85422e10 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -192,7 +192,7 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : appearanceLayout->addWidget(appearance); ui->widgetAppearance->setLayout(appearanceLayout); - connect(appearance, &AppearanceWidget::appearanceChanged, [=](){ + connect(appearance, &AppearanceWidget::appearanceChanged, [this](){ updateWidth(); Q_EMIT appearanceChanged(); }); @@ -274,7 +274,7 @@ void OptionsDialog::setModel(OptionsModel *_model) connect(ui->lang, static_cast(&QValueComboBox::valueChanged), [this]{ showRestartWarning(); }); connect(ui->thirdPartyTxUrls, &QLineEdit::textChanged, [this]{ showRestartWarning(); }); - connect(ui->coinJoinEnabled, &QCheckBox::clicked, [=](bool fChecked) { + connect(ui->coinJoinEnabled, &QCheckBox::clicked, [this, &_model](bool fChecked) { #ifdef ENABLE_WALLET model->node().coinJoinOptions().setEnabled(fChecked); #endif @@ -290,7 +290,7 @@ void OptionsDialog::setModel(OptionsModel *_model) // Store the current CoinJoin enabled state to recover it if it gets changed but the dialog gets not accepted but declined. #ifdef ENABLE_WALLET fCoinJoinEnabledPrev = model->node().coinJoinOptions().isEnabled(); - connect(this, &OptionsDialog::rejected, [=]() { + connect(this, &OptionsDialog::rejected, [this]() { if (fCoinJoinEnabledPrev != model->node().coinJoinOptions().isEnabled()) { ui->coinJoinEnabled->click(); } diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index f5909083a2404d..b13fe784e69abf 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -309,7 +309,7 @@ void OverviewPage::setWalletModel(WalletModel *model) connect(model->getOptionsModel(), &OptionsModel::coinJoinRoundsChanged, this, &OverviewPage::updateCoinJoinProgress); connect(model->getOptionsModel(), &OptionsModel::coinJoinAmountChanged, this, &OverviewPage::updateCoinJoinProgress); connect(model->getOptionsModel(), &OptionsModel::AdvancedCJUIChanged, this, &OverviewPage::updateAdvancedCJUI); - connect(model->getOptionsModel(), &OptionsModel::coinJoinEnabledChanged, [=]() { + connect(model->getOptionsModel(), &OptionsModel::coinJoinEnabledChanged, [this]() { coinJoinStatus(true); }); diff --git a/src/scheduler.cpp b/src/scheduler.cpp index a80ad24433a247..933cf2138a049e 100644 --- a/src/scheduler.cpp +++ b/src/scheduler.cpp @@ -109,7 +109,7 @@ static void Repeat(CScheduler& s, CScheduler::Function f, std::chrono::milliseco void CScheduler::scheduleEvery(CScheduler::Function f, std::chrono::milliseconds delta) { - scheduleFromNow([=] { Repeat(*this, f, delta); }, delta); + scheduleFromNow([this, f, delta] { Repeat(*this, f, delta); }, delta); } size_t CScheduler::getQueueInfo(std::chrono::system_clock::time_point& first,