mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
qt: Use template function qOverload in signal-slot connections
This commit does not change behavior.
This commit is contained in:
parent
e1e1e708fa
commit
cdbc2bd1f1
@ -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<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &BitcoinAmountField::unitChanged);
|
||||
connect(unit, qOverload<int>(&QComboBox::currentIndexChanged), this, &BitcoinAmountField::unitChanged);
|
||||
|
||||
// Set default based on configuration
|
||||
unitChanged(unit->currentIndex());
|
||||
|
@ -561,7 +561,7 @@ void BitcoinGUI::createToolBars()
|
||||
|
||||
m_wallet_selector = new QComboBox();
|
||||
m_wallet_selector->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
connect(m_wallet_selector, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &BitcoinGUI::setCurrentWalletBySelectorIndex);
|
||||
connect(m_wallet_selector, qOverload<int>(&QComboBox::currentIndexChanged), this, &BitcoinGUI::setCurrentWalletBySelectorIndex);
|
||||
|
||||
m_wallet_selector_label = new QLabel();
|
||||
m_wallet_selector_label->setText(tr("Wallet:") + " ");
|
||||
|
@ -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<int>::of(&QSpinBox::valueChanged), [this](int prune_GB) {
|
||||
connect(ui->pruneGB, qOverload<int>(&QSpinBox::valueChanged), [this](int prune_GB) {
|
||||
m_prune_target_gb = prune_GB;
|
||||
UpdatePruneLabels(ui->prune->isChecked());
|
||||
UpdateFreeSpaceLabel();
|
||||
|
@ -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<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning);
|
||||
connect(ui->databaseCache, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning);
|
||||
connect(ui->threadsScriptVerif, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning);
|
||||
connect(ui->pruneSize, qOverload<int>(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning);
|
||||
connect(ui->databaseCache, qOverload<int>(&QSpinBox::valueChanged), this, &OptionsDialog::showRestartWarning);
|
||||
connect(ui->threadsScriptVerif, qOverload<int>(&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<void (QValueComboBox::*)()>(&QValueComboBox::valueChanged), [this]{ showRestartWarning(); });
|
||||
connect(ui->lang, qOverload<>(&QValueComboBox::valueChanged), [this]{ showRestartWarning(); });
|
||||
connect(ui->thirdPartyTxUrls, &QLineEdit::textChanged, [this]{ showRestartWarning(); });
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
QValueComboBox::QValueComboBox(QWidget *parent) :
|
||||
QComboBox(parent), role(Qt::UserRole)
|
||||
{
|
||||
connect(this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &QValueComboBox::handleSelectionChanged);
|
||||
connect(this, qOverload<int>(&QComboBox::currentIndexChanged), this, &QValueComboBox::handleSelectionChanged);
|
||||
}
|
||||
|
||||
QVariant QValueComboBox::value() const
|
||||
|
@ -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<void (RPCConsole::*)(int, const QString&)>(&RPCConsole::message));
|
||||
connect(executor, &RPCExecutor::reply, this, qOverload<int, const QString&>(&RPCConsole::message));
|
||||
|
||||
// Requests from this object must go to executor
|
||||
connect(this, &RPCConsole::cmdRequest, executor, &RPCExecutor::request);
|
||||
|
@ -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<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SendCoinsDialog::updateSmartFeeLabel);
|
||||
connect(ui->confTargetSelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SendCoinsDialog::coinControlUpdateLabels);
|
||||
connect(ui->confTargetSelector, qOverload<int>(&QComboBox::currentIndexChanged), this, &SendCoinsDialog::updateSmartFeeLabel);
|
||||
connect(ui->confTargetSelector, qOverload<int>(&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<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::updateFeeSectionControls);
|
||||
connect(ui->groupFee, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::coinControlUpdateLabels);
|
||||
connect(ui->groupFee, qOverload<int>(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::updateFeeSectionControls);
|
||||
connect(ui->groupFee, qOverload<int>(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::coinControlUpdateLabels);
|
||||
#endif
|
||||
|
||||
connect(ui->customFee, &BitcoinAmountField::valueChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
|
||||
|
@ -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<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseDate);
|
||||
connect(typeWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseType);
|
||||
connect(watchOnlyWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseWatchonly);
|
||||
connect(amountWidget, &QLineEdit::textChanged, amount_typing_delay, static_cast<void (QTimer::*)()>(&QTimer::start));
|
||||
connect(dateWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseDate);
|
||||
connect(typeWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseType);
|
||||
connect(watchOnlyWidget, qOverload<int>(&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<void (QTimer::*)()>(&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);
|
||||
|
@ -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<void (TransactionView::*)(const QModelIndex&)>(&TransactionView::focusTransaction));
|
||||
connect(overviewPage, &OverviewPage::transactionClicked, transactionView, qOverload<const QModelIndex&>(&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<void (TransactionView::*)(const uint256&)>(&TransactionView::focusTransaction));
|
||||
connect(sendCoinsPage, &SendCoinsDialog::coinsSent, transactionView, qOverload<const uint256&>(&TransactionView::focusTransaction));
|
||||
|
||||
// Clicking on "Export" allows to export the transaction list
|
||||
connect(exportButton, &QPushButton::clicked, transactionView, &TransactionView::exportClicked);
|
||||
|
Loading…
Reference in New Issue
Block a user