From cdbc2bd1f1c171848c1fef7f217afe140e1afb06 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Wed, 24 Mar 2021 05:37:56 +0200 Subject: qt: Use template function qOverload in signal-slot connections This commit does not change behavior. --- src/qt/bitcoinamountfield.cpp | 2 +- src/qt/bitcoingui.cpp | 2 +- src/qt/intro.cpp | 2 +- src/qt/optionsdialog.cpp | 8 ++++---- src/qt/qvaluecombobox.cpp | 2 +- src/qt/rpcconsole.cpp | 2 +- src/qt/sendcoinsdialog.cpp | 8 ++++---- src/qt/transactionview.cpp | 10 +++++----- src/qt/walletview.cpp | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index 2af3502be3..ba59bcc660 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -239,7 +239,7 @@ BitcoinAmountField::BitcoinAmountField(QWidget *parent) : // If one if the widgets changes, the combined content changes as well connect(amount, &AmountSpinBox::valueChanged, this, &BitcoinAmountField::valueChanged); - connect(unit, static_cast(&QComboBox::currentIndexChanged), this, &BitcoinAmountField::unitChanged); + connect(unit, qOverload(&QComboBox::currentIndexChanged), this, &BitcoinAmountField::unitChanged); // Set default based on configuration unitChanged(unit->currentIndex()); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 3e29d8e132..a0a84c5522 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -561,7 +561,7 @@ void BitcoinGUI::createToolBars() m_wallet_selector = new QComboBox(); m_wallet_selector->setSizeAdjustPolicy(QComboBox::AdjustToContents); - connect(m_wallet_selector, static_cast(&QComboBox::currentIndexChanged), this, &BitcoinGUI::setCurrentWalletBySelectorIndex); + connect(m_wallet_selector, qOverload(&QComboBox::currentIndexChanged), this, &BitcoinGUI::setCurrentWalletBySelectorIndex); m_wallet_selector_label = new QLabel(); m_wallet_selector_label->setText(tr("Wallet:") + " "); diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index ed39307fd7..0ef5eecd57 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -155,7 +155,7 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si UpdatePruneLabels(prune_checked); UpdateFreeSpaceLabel(); }); - connect(ui->pruneGB, QOverload::of(&QSpinBox::valueChanged), [this](int prune_GB) { + connect(ui->pruneGB, qOverload(&QSpinBox::valueChanged), [this](int prune_GB) { m_prune_target_gb = prune_GB; UpdatePruneLabels(ui->prune->isChecked()); UpdateFreeSpaceLabel(); diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index e6b9488344..8a32994e3f 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -197,9 +197,9 @@ void OptionsDialog::setModel(OptionsModel *_model) /* Main */ connect(ui->prune, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); connect(ui->prune, &QCheckBox::clicked, this, &OptionsDialog::togglePruneWarning); - connect(ui->pruneSize, static_cast(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); - connect(ui->databaseCache, static_cast(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); - connect(ui->threadsScriptVerif, static_cast(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); + connect(ui->pruneSize, qOverload(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); + connect(ui->databaseCache, qOverload(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); + connect(ui->threadsScriptVerif, qOverload(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning); /* Wallet */ connect(ui->spendZeroConfChange, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); /* Network */ @@ -207,7 +207,7 @@ void OptionsDialog::setModel(OptionsModel *_model) connect(ui->connectSocks, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); connect(ui->connectSocksTor, &QCheckBox::clicked, this, &OptionsDialog::showRestartWarning); /* Display */ - connect(ui->lang, static_cast(&QValueComboBox::valueChanged), [this]{ showRestartWarning(); }); + connect(ui->lang, qOverload<>(&QValueComboBox::valueChanged), [this]{ showRestartWarning(); }); connect(ui->thirdPartyTxUrls, &QLineEdit::textChanged, [this]{ showRestartWarning(); }); } diff --git a/src/qt/qvaluecombobox.cpp b/src/qt/qvaluecombobox.cpp index 76f94ecf85..5672396819 100644 --- a/src/qt/qvaluecombobox.cpp +++ b/src/qt/qvaluecombobox.cpp @@ -7,7 +7,7 @@ QValueComboBox::QValueComboBox(QWidget *parent) : QComboBox(parent), role(Qt::UserRole) { - connect(this, static_cast(&QComboBox::currentIndexChanged), this, &QValueComboBox::handleSelectionChanged); + connect(this, qOverload(&QComboBox::currentIndexChanged), this, &QValueComboBox::handleSelectionChanged); } QVariant QValueComboBox::value() const diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 006f60e7a1..10ca86c0e3 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -959,7 +959,7 @@ void RPCConsole::startExecutor() executor->moveToThread(&thread); // Replies from executor object must go to this object - connect(executor, &RPCExecutor::reply, this, static_cast(&RPCConsole::message)); + connect(executor, &RPCExecutor::reply, this, qOverload(&RPCConsole::message)); // Requests from this object must go to executor connect(this, &RPCConsole::cmdRequest, executor, &RPCExecutor::request); diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index e1a4faa266..8f26f5a8db 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -173,15 +173,15 @@ void SendCoinsDialog::setModel(WalletModel *_model) for (const int n : confTargets) { ui->confTargetSelector->addItem(tr("%1 (%2 blocks)").arg(GUIUtil::formatNiceTimeOffset(n*Params().GetConsensus().nPowTargetSpacing)).arg(n)); } - connect(ui->confTargetSelector, static_cast(&QComboBox::currentIndexChanged), this, &SendCoinsDialog::updateSmartFeeLabel); - connect(ui->confTargetSelector, static_cast(&QComboBox::currentIndexChanged), this, &SendCoinsDialog::coinControlUpdateLabels); + connect(ui->confTargetSelector, qOverload(&QComboBox::currentIndexChanged), this, &SendCoinsDialog::updateSmartFeeLabel); + connect(ui->confTargetSelector, qOverload(&QComboBox::currentIndexChanged), this, &SendCoinsDialog::coinControlUpdateLabels); #if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) connect(ui->groupFee, &QButtonGroup::idClicked, this, &SendCoinsDialog::updateFeeSectionControls); connect(ui->groupFee, &QButtonGroup::idClicked, this, &SendCoinsDialog::coinControlUpdateLabels); #else - connect(ui->groupFee, static_cast(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::updateFeeSectionControls); - connect(ui->groupFee, static_cast(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::coinControlUpdateLabels); + connect(ui->groupFee, qOverload(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::updateFeeSectionControls); + connect(ui->groupFee, qOverload(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::coinControlUpdateLabels); #endif connect(ui->customFee, &BitcoinAmountField::valueChanged, this, &SendCoinsDialog::coinControlUpdateLabels); diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 890d1a1740..0ffd213ffa 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -177,12 +177,12 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa abandonAction = contextMenu->addAction(tr("Abandon transaction"), this, &TransactionView::abandonTx); contextMenu->addAction(tr("Edit address label"), this, &TransactionView::editLabel); - connect(dateWidget, static_cast(&QComboBox::activated), this, &TransactionView::chooseDate); - connect(typeWidget, static_cast(&QComboBox::activated), this, &TransactionView::chooseType); - connect(watchOnlyWidget, static_cast(&QComboBox::activated), this, &TransactionView::chooseWatchonly); - connect(amountWidget, &QLineEdit::textChanged, amount_typing_delay, static_cast(&QTimer::start)); + connect(dateWidget, qOverload(&QComboBox::activated), this, &TransactionView::chooseDate); + connect(typeWidget, qOverload(&QComboBox::activated), this, &TransactionView::chooseType); + connect(watchOnlyWidget, qOverload(&QComboBox::activated), this, &TransactionView::chooseWatchonly); + connect(amountWidget, &QLineEdit::textChanged, amount_typing_delay, qOverload<>(&QTimer::start)); connect(amount_typing_delay, &QTimer::timeout, this, &TransactionView::changedAmount); - connect(search_widget, &QLineEdit::textChanged, prefix_typing_delay, static_cast(&QTimer::start)); + connect(search_widget, &QLineEdit::textChanged, prefix_typing_delay, qOverload<>(&QTimer::start)); connect(prefix_typing_delay, &QTimer::timeout, this, &TransactionView::changedSearch); connect(transactionView, &QTableView::doubleClicked, this, &TransactionView::doubleClicked); diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 8612893683..67cc42725b 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -71,13 +71,13 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): connect(overviewPage, &OverviewPage::transactionClicked, this, &WalletView::transactionClicked); // Clicking on a transaction on the overview pre-selects the transaction on the transaction history page - connect(overviewPage, &OverviewPage::transactionClicked, transactionView, static_cast(&TransactionView::focusTransaction)); + connect(overviewPage, &OverviewPage::transactionClicked, transactionView, qOverload(&TransactionView::focusTransaction)); connect(overviewPage, &OverviewPage::outOfSyncWarningClicked, this, &WalletView::requestedSyncWarningInfo); connect(sendCoinsPage, &SendCoinsDialog::coinsSent, this, &WalletView::coinsSent); // Highlight transaction after send - connect(sendCoinsPage, &SendCoinsDialog::coinsSent, transactionView, static_cast(&TransactionView::focusTransaction)); + connect(sendCoinsPage, &SendCoinsDialog::coinsSent, transactionView, qOverload(&TransactionView::focusTransaction)); // Clicking on "Export" allows to export the transaction list connect(exportButton, &QPushButton::clicked, transactionView, &TransactionView::exportClicked); -- cgit v1.2.3