diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index c1f4bf8481..83498a936c 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -43,7 +43,7 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget* parent) switch(mode) { case ForSending: - connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept())); + connect(ui->tableView, &QTableView::doubleClicked, this, &QDialog::accept); ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableView->setFocus(); break; @@ -89,18 +89,18 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget* parent) contextMenu->addAction(verifyMessageAction); // Connect signals for context menu actions - connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(on_copyToClipboardButton_clicked())); - connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(onCopyLabelAction())); - connect(editAction, SIGNAL(triggered()), this, SLOT(onEditAction())); - connect(deleteAction, SIGNAL(triggered()), this, SLOT(on_deleteButton_clicked())); - connect(showQRCodeAction, SIGNAL(triggered()), this, SLOT(on_showQRCodeButton_clicked())); - connect(signMessageAction, SIGNAL(triggered()), this, SLOT(on_signMessageButton_clicked())); - connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(on_verifyMessageButton_clicked())); + connect(copyAddressAction, &QAction::triggered, this, &AddressBookPage::on_copyToClipboardButton_clicked); + connect(copyLabelAction, &QAction::triggered, this, &AddressBookPage::onCopyLabelAction); + connect(editAction, &QAction::triggered, this, &AddressBookPage::onEditAction); + connect(deleteAction, &QAction::triggered, this, &AddressBookPage::on_deleteButton_clicked); + connect(showQRCodeAction, &QAction::triggered, this, &AddressBookPage::on_showQRCodeButton_clicked); + connect(signMessageAction, &QAction::triggered, this, &AddressBookPage::on_signMessageButton_clicked); + connect(verifyMessageAction, &QAction::triggered, this, &AddressBookPage::on_verifyMessageButton_clicked); - connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); + connect(ui->tableView, &QWidget::customContextMenuRequested, this, &AddressBookPage::contextualMenu); // Pass through accept action from button box - connect(ui->okayButtonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(ui->okayButtonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); } AddressBookPage::~AddressBookPage() @@ -148,12 +148,12 @@ void AddressBookPage::setModel(AddressTableModel *model) ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents); ui->tableView->horizontalHeader()->resizeSection(AddressTableModel::Address, 320); - connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(selectionChanged())); + connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &AddressBookPage::selectionChanged); // Select row for newly created address - connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(selectNewAddress(QModelIndex,int,int))); + connect(model, &AddressTableModel::rowsInserted, + this, &AddressBookPage::selectNewAddress); selectionChanged(); } diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index 01d1536d32..f905635af1 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -68,9 +68,9 @@ AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget* parent) } textChanged(); - connect(ui->oldPassphraseEdit, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); - connect(ui->newPassphraseEdit, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); - connect(ui->repeatNewPassphraseEdit, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); + connect(ui->oldPassphraseEdit, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged); + connect(ui->newPassphraseEdit, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged); + connect(ui->repeatNewPassphraseEdit, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged); } AskPassphraseDialog::~AskPassphraseDialog() diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index ec918ab9ba..9f4e027bc8 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -37,8 +37,11 @@ BitcoinAmountField::BitcoinAmountField(QWidget* parent) : QWidget(parent), amoun setFocusProxy(amount); // If one of the widgets changes, the combined content changes as well - connect(amount, SIGNAL(valueChanged(QString)), this, SIGNAL(textChanged())); - connect(unit, SIGNAL(currentIndexChanged(int)), this, SLOT(unitChanged(int))); + connect(amount, static_cast(&QDoubleSpinBox::valueChanged), + this, &BitcoinAmountField::textChanged); + connect(unit, static_cast(&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 bb82b962a6..b827476ba0 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -207,26 +207,26 @@ BitcoinGUI::BitcoinGUI(QWidget* parent) statusBar()->setSizeGripEnabled(false); // Clicking on a transaction on the overview page simply sends you to transaction history page - connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage())); - connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex))); + connect(overviewPage, &OverviewPage::transactionClicked, this, &BitcoinGUI::gotoHistoryPage); + connect(overviewPage, &OverviewPage::transactionClicked, transactionView, &TransactionView::focusTransaction); // Clicking on the current poll label on the overview page simply sends you to the voting page - connect(overviewPage, SIGNAL(pollLabelClicked()), this, SLOT(gotoVotingPage())); + connect(overviewPage, &OverviewPage::pollLabelClicked, this, &BitcoinGUI::gotoVotingPage); // Double-clicking on a transaction on the transaction history page shows details - connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails())); + connect(transactionView, &TransactionView::doubleClicked, transactionView, &TransactionView::showDetails); rpcConsole = new RPCConsole(this); - connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show())); + connect(openRPCConsoleAction, &QAction::triggered, rpcConsole, &QWidget::show); diagnosticsDialog = new DiagnosticsDialog(this); // Clicking on "Verify Message" in the address book sends you to the verify message tab - connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString))); + connect(addressBookPage, &FavoritesPage::verifyMessage, this, &BitcoinGUI::gotoVerifyMessageTab); // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab - connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString))); + connect(receiveCoinsPage, &ReceiveCoinsPage::signMessage, this, &BitcoinGUI::gotoSignMessageTab); - connect(openConfigAction, SIGNAL(triggered()), this, SLOT(openConfigClicked())); + connect(openConfigAction, &QAction::triggered, this, &BitcoinGUI::openConfigClicked); gotoOverviewPage(); } @@ -336,23 +336,24 @@ void BitcoinGUI::createActions() boincAction->setStatusTip(tr("Gridcoin rewards distributed computing with BOINC")); boincAction->setMenuRole(QAction::TextHeuristicRole); - connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); - connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); - connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); - connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); - connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage())); - connect(votingAction, SIGNAL(triggered()), this, SLOT(gotoVotingPage())); - - connect(websiteAction, SIGNAL(triggered()), this, SLOT(websiteClicked())); - connect(bxAction, SIGNAL(triggered()), this, SLOT(bxClicked())); - connect(exchangeAction, SIGNAL(triggered()), this, SLOT(exchangeClicked())); - connect(boincAction, SIGNAL(triggered()), this, SLOT(boincStatsClicked())); - connect(chatAction, SIGNAL(triggered()), this, SLOT(chatClicked())); + // We use lambdas here to squash the argument to showNormalIfMinized. + connect(overviewAction, &QAction::triggered, this, [this]{ this->showNormalIfMinimized(); }); + connect(overviewAction, &QAction::triggered, this, &BitcoinGUI::gotoOverviewPage); + connect(sendCoinsAction, &QAction::triggered, this, [this]{ this->showNormalIfMinimized(); }); + connect(sendCoinsAction, &QAction::triggered, this, &BitcoinGUI::gotoSendCoinsPage); + connect(receiveCoinsAction, &QAction::triggered, this, [this]{ this->showNormalIfMinimized(); }); + connect(receiveCoinsAction, &QAction::triggered, this, &BitcoinGUI::gotoReceiveCoinsPage); + connect(historyAction, &QAction::triggered, this, [this]{ this->showNormalIfMinimized(); }); + connect(historyAction, &QAction::triggered, this, &BitcoinGUI::gotoHistoryPage); + connect(addressBookAction, &QAction::triggered, this, [this]{ this->showNormalIfMinimized(); }); + connect(addressBookAction, &QAction::triggered, this, &BitcoinGUI::gotoAddressBookPage); + connect(votingAction, &QAction::triggered, this, &BitcoinGUI::gotoVotingPage); + + connect(websiteAction, &QAction::triggered, this, &BitcoinGUI::websiteClicked); + connect(bxAction, &QAction::triggered, this, &BitcoinGUI::bxClicked); + connect(exchangeAction, &QAction::triggered, this, &BitcoinGUI::exchangeClicked); + connect(boincAction, &QAction::triggered, this, &BitcoinGUI::boincStatsClicked); + connect(chatAction, &QAction::triggered, this, &BitcoinGUI::chatClicked); quitAction = new QAction(tr("E&xit"), this); quitAction->setToolTip(tr("Quit application")); @@ -407,21 +408,21 @@ void BitcoinGUI::createActions() resetblockchainAction = new QAction(tr("&Reset blockchain data"), this); resetblockchainAction->setToolTip(tr("Remove blockchain data and start chain from zero")); - connect(quitAction, SIGNAL(triggered()), this, SLOT(tryQuit())); - connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); - connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked())); - connect(researcherAction, SIGNAL(triggered()), this, SLOT(researcherClicked())); - connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden())); - connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool))); - connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet())); - connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase())); - connect(unlockWalletAction, SIGNAL(triggered()), this, SLOT(unlockWallet())); - connect(lockWalletAction, SIGNAL(triggered()), this, SLOT(lockWallet())); - connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); - connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); - connect(diagnosticsAction, SIGNAL(triggered()), this, SLOT(diagnosticsClicked())); - connect(snapshotAction, SIGNAL(triggered()), this, SLOT(snapshotClicked())); - connect(resetblockchainAction, SIGNAL(triggered()), this, SLOT(resetblockchainClicked())); + connect(quitAction, &QAction::triggered, this, &BitcoinGUI::tryQuit); + connect(aboutAction, &QAction::triggered, this, &BitcoinGUI::aboutClicked); + connect(optionsAction, &QAction::triggered, this, &BitcoinGUI::optionsClicked); + connect(researcherAction, &QAction::triggered, this, &BitcoinGUI::researcherClicked); + connect(toggleHideAction, &QAction::triggered, this, [this]{ this->showNormalIfMinimized(true); }); + connect(encryptWalletAction, &QAction::triggered, this, &BitcoinGUI::encryptWallet); + connect(backupWalletAction, &QAction::triggered, this, &BitcoinGUI::backupWallet); + connect(changePassphraseAction, &QAction::triggered, this, &BitcoinGUI::changePassphrase); + connect(unlockWalletAction, &QAction::triggered, this, &BitcoinGUI::unlockWallet); + connect(lockWalletAction, &QAction::triggered, this, &BitcoinGUI::lockWallet); + connect(signMessageAction, &QAction::triggered, this, [this]{ this->gotoSignMessageTab(QString {}); }); + connect(verifyMessageAction, &QAction::triggered, this, [this]{ this->gotoVerifyMessageTab(QString {}); }); + connect(diagnosticsAction, &QAction::triggered, this, &BitcoinGUI::diagnosticsClicked); + connect(snapshotAction, &QAction::triggered, this, &BitcoinGUI::snapshotClicked); + connect(resetblockchainAction, &QAction::triggered, this, &BitcoinGUI::resetblockchainClicked); } void BitcoinGUI::setIcons() @@ -582,7 +583,7 @@ void BitcoinGUI::createToolBars() QSizePolicy logoLabelSizePolicy = logoLabel->sizePolicy(); logoLabelSizePolicy.setHorizontalStretch(2); logoLabel->setSizePolicy(logoLabelSizePolicy); - connect(logoLabel, SIGNAL(clicked()), this, SLOT(websiteClicked())); + connect(logoLabel, &ClickLabel::clicked, this, &BitcoinGUI::websiteClicked); QHBoxLayout *logoWrapperLayout = new QHBoxLayout(); logoWrapperLayout->setContentsMargins(2, 0, 2, 0); @@ -616,7 +617,7 @@ void BitcoinGUI::createToolBars() QSizePolicy themeToggleButtonSizePolicy = themeToggleButton->sizePolicy(); themeToggleButtonSizePolicy.setHorizontalStretch(1); themeToggleButton->setSizePolicy(themeToggleButtonSizePolicy); - connect(themeToggleButton, SIGNAL(clicked()), this, SLOT(themeToggled())); + connect(themeToggleButton, &QPushButton::clicked, this, &BitcoinGUI::themeToggled); logoWrapperLayout->addWidget(themeToggleButton); logoWrapperLayout->setAlignment(themeToggleButton, Qt::AlignHCenter | Qt::AlignVCenter); @@ -625,7 +626,7 @@ void BitcoinGUI::createToolBars() ClickLabel *boincLabel = new ClickLabel(); boincLabel->setObjectName("toolbarBoincLabel"); - connect(boincLabel, SIGNAL(clicked()), this, SLOT(boincClicked())); + connect(boincLabel, &ClickLabel::clicked, this, &BitcoinGUI::boincClicked); // "Tabs" toolbar (vertical, aligned on left side of overview screen). QToolBar *toolbar = addToolBar("Tabs toolbar"); @@ -679,11 +680,11 @@ void BitcoinGUI::createToolBars() labelEncryptionIcon = new QLabel(); labelStakingIcon = new QLabel(); labelConnectionsIcon = new ClickLabel(); - connect(labelConnectionsIcon, SIGNAL(clicked()), this, SLOT(peersClicked())); + connect(labelConnectionsIcon, &ClickLabel::clicked, this, &BitcoinGUI::peersClicked); labelBlocksIcon = new QLabel(); labelScraperIcon = new QLabel(); labelBeaconIcon = new ClickLabel(); - connect(labelBeaconIcon, SIGNAL(clicked()), this, SLOT(researcherClicked())); + connect(labelBeaconIcon, &ClickLabel::clicked, this, &BitcoinGUI::researcherClicked); frameBlocksLayout->addWidget(labelBeaconIcon); frameBlocksLayout->addWidget(labelBlocksIcon); @@ -734,28 +735,28 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel) // set stylesheet setOptionsStyleSheet(this->clientModel->getOptionsModel()->getCurrentStyle()); - connect(this->clientModel->getOptionsModel(),SIGNAL(walletStylesheetChanged(QString)),this,SLOT(setOptionsStyleSheet(QString))); + connect(this->clientModel->getOptionsModel(), &OptionsModel::walletStylesheetChanged, + this, &BitcoinGUI::setOptionsStyleSheet); // Keep up to date with client setNumConnections(clientModel->getNumConnections()); - connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); + connect(clientModel, &ClientModel::numConnectionsChanged, this, &BitcoinGUI::setNumConnections); setNumBlocks(clientModel->getNumBlocks(), clientModel->getNumBlocksOfPeers()); - connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int))); + connect(clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks); setDifficulty(clientModel->getDifficulty()); - connect(clientModel, SIGNAL(difficultyChanged(double)), this, SLOT(setDifficulty(double))); + connect(clientModel, &ClientModel::difficultyChanged, this, &BitcoinGUI::setDifficulty); setMinerStatus(false, 0.0, 0.0, 0.0); - connect(clientModel, SIGNAL(minerStatusChanged(bool, double, double, double)), - this, SLOT(setMinerStatus(bool, double, double, double))); + connect(clientModel, &ClientModel::minerStatusChanged, this, &BitcoinGUI::setMinerStatus); // Start with out-of-sync message for scraper/NN. updateScraperIcon((int)scrapereventtypes::OutOfSync, CT_UPDATING); - connect(clientModel, SIGNAL(updateScraperStatus(int, int)), this, SLOT(updateScraperIcon(int, int))); + connect(clientModel, &ClientModel::updateScraperStatus, this, &BitcoinGUI::updateScraperIcon); // Report errors from network/worker thread - connect(clientModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool))); + connect(clientModel, &ClientModel::error, this, &BitcoinGUI::error); rpcConsole->setClientModel(clientModel); addressBookPage->setOptionsModel(clientModel->getOptionsModel()); @@ -774,7 +775,7 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel) createTrayIconMenu(); // Report errors from wallet thread - connect(walletModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool))); + connect(walletModel, &WalletModel::error, this, &BitcoinGUI::error); // Put transaction list in tabs transactionView->setModel(walletModel); @@ -786,14 +787,14 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel) signVerifyMessageDialog->setModel(walletModel); setEncryptionStatus(walletModel->getEncryptionStatus()); - connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SLOT(setEncryptionStatus(int))); + connect(walletModel, &WalletModel::encryptionStatusChanged, this, &BitcoinGUI::setEncryptionStatus); // Balloon pop-up for new transaction - connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(incomingTransaction(QModelIndex,int,int))); + connect(walletModel->getTransactionTableModel(), &TransactionTableModel::rowsInserted, + this, &BitcoinGUI::incomingTransaction); // Ask for passphrase if needed - connect(walletModel, SIGNAL(requireUnlock()), this, SLOT(unlockWallet())); + connect(walletModel, &WalletModel::requireUnlock, this, &BitcoinGUI::unlockWallet); } } @@ -809,7 +810,7 @@ void BitcoinGUI::setResearcherModel(ResearcherModel *researcherModel) diagnosticsDialog->SetResearcherModel(researcherModel); updateBeaconIcon(); - connect(researcherModel, SIGNAL(beaconChanged()), this, SLOT(updateBeaconIcon())); + connect(researcherModel, &ResearcherModel::beaconChanged, this, &BitcoinGUI::updateBeaconIcon); } void BitcoinGUI::setVotingModel(VotingModel *votingModel) @@ -823,7 +824,7 @@ void BitcoinGUI::setVotingModel(VotingModel *votingModel) overviewPage->setCurrentPollTitle(votingModel->getCurrentPollTitle()); - connect(votingModel, SIGNAL(newPollReceived()), this, SLOT(handleNewPoll())); + connect(votingModel, &VotingModel::newPollReceived, this, &BitcoinGUI::handleNewPoll); } void BitcoinGUI::createTrayIcon() @@ -848,8 +849,7 @@ void BitcoinGUI::createTrayIconMenu() trayIconMenu = new QMenu(this); trayIcon->setContextMenu(trayIconMenu); - connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason))); + connect(trayIcon, &QSystemTrayIcon::activated, this, &BitcoinGUI::trayIconActivated); #else // Note: On Mac, the dock icon is used to provide the tray's functionality. MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance(); @@ -1098,7 +1098,7 @@ void BitcoinGUI::update(const QString &title, const QString& version, const QStr // Due to slight delay in gui load this could appear behind the gui ui // The only other option available would make the message box stay on top of all applications - QTimer::singleShot(5000, updateMessageDialog.get(), SLOT(show())); + QTimer::singleShot(5000, updateMessageDialog.get(), [this]() { updateMessageDialog->show(); }); } void BitcoinGUI::changeEvent(QEvent *e) @@ -1112,7 +1112,7 @@ void BitcoinGUI::changeEvent(QEvent *e) QWindowStateChangeEvent *wsevt = static_cast(e); if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized()) { - QTimer::singleShot(0, this, SLOT(hide())); + QTimer::singleShot(0, this, &BitcoinGUI::hide); e->ignore(); } } @@ -1347,7 +1347,7 @@ void BitcoinGUI::gotoOverviewPage() centralWidget->setCurrentWidget(overviewPage); exportAction->setEnabled(false); - disconnect(exportAction, SIGNAL(triggered()), nullptr, nullptr); + disconnect(exportAction, &QAction::triggered, nullptr, nullptr); } void BitcoinGUI::gotoHistoryPage() @@ -1356,8 +1356,8 @@ void BitcoinGUI::gotoHistoryPage() centralWidget->setCurrentWidget(transactionView); exportAction->setEnabled(true); - disconnect(exportAction, SIGNAL(triggered()), nullptr, nullptr); - connect(exportAction, SIGNAL(triggered()), transactionView, SLOT(exportClicked())); + disconnect(exportAction, &QAction::triggered, nullptr, nullptr); + connect(exportAction, &QAction::triggered, transactionView, &TransactionView::exportClicked); } void BitcoinGUI::gotoAddressBookPage() @@ -1366,8 +1366,8 @@ void BitcoinGUI::gotoAddressBookPage() centralWidget->setCurrentWidget(addressBookPage); exportAction->setEnabled(true); - disconnect(exportAction, SIGNAL(triggered()), nullptr, nullptr); - connect(exportAction, SIGNAL(triggered()), addressBookPage, SLOT(exportClicked())); + disconnect(exportAction, &QAction::triggered, nullptr, nullptr); + connect(exportAction, &QAction::triggered, addressBookPage, &FavoritesPage::exportClicked); } void BitcoinGUI::gotoReceiveCoinsPage() @@ -1376,8 +1376,8 @@ void BitcoinGUI::gotoReceiveCoinsPage() centralWidget->setCurrentWidget(receiveCoinsPage); exportAction->setEnabled(true); - disconnect(exportAction, SIGNAL(triggered()), nullptr, nullptr); - connect(exportAction, SIGNAL(triggered()), receiveCoinsPage, SLOT(exportClicked())); + disconnect(exportAction, &QAction::triggered, nullptr, nullptr); + connect(exportAction, &QAction::triggered, receiveCoinsPage, &ReceiveCoinsPage::exportClicked); } void BitcoinGUI::gotoSendCoinsPage() @@ -1386,7 +1386,7 @@ void BitcoinGUI::gotoSendCoinsPage() centralWidget->setCurrentWidget(sendCoinsPage); exportAction->setEnabled(false); - disconnect(exportAction, SIGNAL(triggered()), nullptr, nullptr); + disconnect(exportAction, &QAction::triggered, nullptr, nullptr); } void BitcoinGUI::gotoVotingPage() @@ -1395,7 +1395,7 @@ void BitcoinGUI::gotoVotingPage() centralWidget->setCurrentWidget(votingPage); exportAction->setEnabled(false); - disconnect(exportAction, SIGNAL(triggered()), nullptr, nullptr); + disconnect(exportAction, &QAction::triggered, nullptr, nullptr); } void BitcoinGUI::gotoSignMessageTab(QString addr) @@ -1578,11 +1578,6 @@ void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden) hide(); } -void BitcoinGUI::toggleHidden() -{ - showNormalIfMinimized(true); -} - void BitcoinGUI::updateWeight() { if (!pwalletMain) diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index b348084a8c..4bf690f322 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -27,6 +27,7 @@ class SignVerifyMessageDialog; class Notificator; class RPCConsole; class DiagnosticsDialog; +class ClickLabel; QT_BEGIN_NAMESPACE class QLabel; @@ -98,10 +99,10 @@ class BitcoinGUI : public QMainWindow QLabel *statusbarAlertsLabel; QLabel *labelEncryptionIcon; QLabel *labelStakingIcon; - QLabel *labelConnectionsIcon; + ClickLabel *labelConnectionsIcon; QLabel *labelBlocksIcon; QLabel *labelScraperIcon; - QLabel *labelBeaconIcon; + ClickLabel *labelBeaconIcon; // Windows and Linux: collapse the main application's menu bar into a menu // button. On macOS, we'll continue to use the system's separate menu bar. @@ -218,12 +219,10 @@ private slots: void gotoSendCoinsPage(); /** Switch to voting page */ void gotoVotingPage(); - /** Show Sign/Verify Message dialog and switch to sign message tab */ void gotoSignMessageTab(QString addr = ""); /** Show Sign/Verify Message dialog and switch to verify message tab */ void gotoVerifyMessageTab(QString addr = ""); - /** Show configuration dialog */ void optionsClicked(); /** Switch the active light/dark theme */ @@ -269,8 +268,6 @@ private slots: /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */ void showNormalIfMinimized(bool fToggleHidden = false); - /** simply calls showNormalIfMinimized(true) for use in SLOT() macro */ - void toggleHidden(); void updateWeight(); void updateStakingIcon(bool staking, double net_weight, double coin_weight, double etts_days); diff --git a/src/qt/clicklabel.h b/src/qt/clicklabel.h index 70cc79cc36..c81d60dd11 100644 --- a/src/qt/clicklabel.h +++ b/src/qt/clicklabel.h @@ -5,7 +5,7 @@ #include #include -class ClickLabel:public QLabel +class ClickLabel: public QLabel { Q_OBJECT public: diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index d9b83b0108..ecf9083fa8 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -40,7 +40,7 @@ ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) pollTimer = new QTimer(this); pollTimer->setInterval(MODEL_UPDATE_DELAY); pollTimer->start(); - connect(pollTimer, SIGNAL(timeout()), this, SLOT(updateTimer())); + connect(pollTimer, &QTimer::timeout, this, &ClientModel::updateTimer); subscribeToCoreSignals(); } diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index afd1a88845..710a775d5a 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -60,13 +60,13 @@ CoinControlDialog::CoinControlDialog(QWidget* parent, CCoinControl* coinControl, //contextMenu->addAction(unlockAction); // context menu signals - connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); - connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); - connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); - connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); - connect(copyTransactionHashAction, SIGNAL(triggered()), this, SLOT(copyTransactionHash())); - //connect(lockAction, SIGNAL(triggered()), this, SLOT(lockCoin())); - //connect(unlockAction, SIGNAL(triggered()), this, SLOT(unlockCoin())); + connect(ui->treeWidget, &QWidget::customContextMenuRequested, this, &CoinControlDialog::showMenu); + connect(copyAddressAction, &QAction::triggered, this, &CoinControlDialog::copyAddress); + connect(copyLabelAction, &QAction::triggered, this, &CoinControlDialog::copyLabel); + connect(copyAmountAction, &QAction::triggered, this, &CoinControlDialog::copyAmount); + connect(copyTransactionHashAction, &QAction::triggered, this, &CoinControlDialog::copyTransactionHash); + //connect(lockAction, &QAction::triggered, this, &CoinControlDialog::lockCoin); + //connect(unlockAction, &QAction::triggered, this, &CoinControlDialog::unlockCoin); // clipboard actions QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this); @@ -78,14 +78,14 @@ CoinControlDialog::CoinControlDialog(QWidget* parent, CCoinControl* coinControl, QAction *clipboardLowOutputAction = new QAction(tr("Copy low output"), this); QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); - connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(clipboardQuantity())); - connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(clipboardAmount())); - connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(clipboardFee())); - connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(clipboardAfterFee())); - connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(clipboardBytes())); - connect(clipboardPriorityAction, SIGNAL(triggered()), this, SLOT(clipboardPriority())); - connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(clipboardLowOutput())); - connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(clipboardChange())); + connect(clipboardQuantityAction, &QAction::triggered, this, &CoinControlDialog::clipboardQuantity); + connect(clipboardAmountAction, &QAction::triggered, this, &CoinControlDialog::clipboardAmount); + connect(clipboardFeeAction, &QAction::triggered, this, &CoinControlDialog::clipboardFee); + connect(clipboardAfterFeeAction, &QAction::triggered, this, &CoinControlDialog::clipboardAfterFee); + connect(clipboardBytesAction, &QAction::triggered, this, &CoinControlDialog::clipboardBytes); + connect(clipboardPriorityAction, &QAction::triggered, this, &CoinControlDialog::clipboardPriority); + connect(clipboardLowOutputAction, &QAction::triggered, this, &CoinControlDialog::clipboardLowOutput); + connect(clipboardChangeAction, &QAction::triggered, this, &CoinControlDialog::clipboardChange); ui->coinControlQuantityLabel->addAction(clipboardQuantityAction); ui->coinControlAmountLabel->addAction(clipboardAmountAction); @@ -97,33 +97,33 @@ CoinControlDialog::CoinControlDialog(QWidget* parent, CCoinControl* coinControl, ui->coinControlChangeLabel->addAction(clipboardChangeAction); // toggle tree/list mode - connect(ui->treeModeRadioButton, SIGNAL(toggled(bool)), this, SLOT(treeModeRadioButton(bool))); - connect(ui->listModeRadioButton, SIGNAL(toggled(bool)), this, SLOT(listModeRadioButton(bool))); + connect(ui->treeModeRadioButton, &QRadioButton::toggled, this, &CoinControlDialog::treeModeRadioButton); + connect(ui->listModeRadioButton, &QRadioButton::toggled, this, &CoinControlDialog::listModeRadioButton); // click on checkbox - connect(ui->treeWidget, SIGNAL(itemChanged( QTreeWidgetItem*, int)), this, SLOT(viewItemChanged( QTreeWidgetItem*, int))); + connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &CoinControlDialog::viewItemChanged); // click on header ui->treeWidget->header()->setSectionsClickable(true); - connect(ui->treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(headerSectionClicked(int))); + connect(ui->treeWidget->header(), &QHeaderView::sectionClicked, this, &CoinControlDialog::headerSectionClicked); // ok button - connect(ui->buttonBox, SIGNAL(clicked( QAbstractButton*)), this, SLOT(buttonBoxClicked(QAbstractButton*))); + connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &CoinControlDialog::buttonBoxClicked); // (un)select all - connect(ui->selectAllPushButton, SIGNAL(clicked()), this, SLOT(buttonSelectAllClicked())); + connect(ui->selectAllPushButton, &QPushButton::clicked, this, &CoinControlDialog::buttonSelectAllClicked); // filter/consolidate button interaction - connect(ui->maxMinOutputValue, SIGNAL(textChanged()), this, SLOT(maxMinOutputValueChanged())); + connect(ui->maxMinOutputValue, &BitcoinAmountField::textChanged, this, &CoinControlDialog::maxMinOutputValueChanged); // filter mode - connect(ui->filterModePushButton, SIGNAL(clicked()), this, SLOT(buttonFilterModeClicked())); + connect(ui->filterModePushButton, &QPushButton::clicked, this, &CoinControlDialog::buttonFilterModeClicked); // filter - connect(ui->filterPushButton, SIGNAL(clicked()), this, SLOT(buttonFilterClicked())); + connect(ui->filterPushButton, &QPushButton::clicked, this, &CoinControlDialog::buttonFilterClicked); // consolidate - connect(ui->consolidateButton, SIGNAL(clicked()), this, SLOT(buttonConsolidateClicked())); + connect(ui->consolidateButton, &QPushButton::clicked, this, &CoinControlDialog::buttonConsolidateClicked); ui->treeWidget->setColumnWidth(COLUMN_CHECKBOX, 150); ui->treeWidget->setColumnWidth(COLUMN_AMOUNT, 170); @@ -393,8 +393,8 @@ void CoinControlDialog::buttonConsolidateClicked() if (culled_inputs) consolidateUnspentDialog.SetOutputWarningVisible(true); - connect(&consolidateUnspentDialog, SIGNAL(selectedConsolidationAddressSignal(std::pair)), - this, SLOT(selectedConsolidationAddressSlot(std::pair))); + connect(&consolidateUnspentDialog, &ConsolidateUnspentDialog::selectedConsolidationAddressSignal, + this, &CoinControlDialog::selectedConsolidationAddressSlot); consolidateUnspentDialog.exec(); } diff --git a/src/qt/consolidateunspentdialog.cpp b/src/qt/consolidateunspentdialog.cpp index 261b501507..40f3221309 100644 --- a/src/qt/consolidateunspentdialog.cpp +++ b/src/qt/consolidateunspentdialog.cpp @@ -1,5 +1,6 @@ #include "consolidateunspentdialog.h" #include "qt/decoration.h" +#include #include "ui_consolidateunspentdialog.h" #include "util.h" @@ -18,10 +19,10 @@ ConsolidateUnspentDialog::ConsolidateUnspentDialog(QWidget *parent, size_t input ui->addressTableWidget->setSelectionMode(QAbstractItemView::SingleSelection); // ok button - connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonBoxClicked(QAbstractButton*))); + connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &ConsolidateUnspentDialog::buttonBoxClicked); // destination address selection - connect(ui->addressTableWidget, SIGNAL(itemSelectionChanged()), this, SLOT(addressSelectionChanged())); + connect(ui->addressTableWidget, &QTableWidget::itemSelectionChanged, this, &ConsolidateUnspentDialog::addressSelectionChanged); ui->outputLimitWarningLabel->setText(tr("Note: The number of inputs selected for consolidation has been " "limited to %1 to prevent a transaction failure due to too many " diff --git a/src/qt/consolidateunspentwizard.cpp b/src/qt/consolidateunspentwizard.cpp index d395340fa9..a7d402ed93 100644 --- a/src/qt/consolidateunspentwizard.cpp +++ b/src/qt/consolidateunspentwizard.cpp @@ -23,15 +23,16 @@ ConsolidateUnspentWizard::ConsolidateUnspentWizard(QWidget *parent, ui->selectInputsPage->setCoinControl(coinControl); ui->selectInputsPage->setPayAmounts(payAmounts); - connect(ui->selectInputsPage, SIGNAL(setAddressListSignal(std::map)), - ui->selectDestinationPage, SLOT(SetAddressList(const std::map))); + connect(ui->selectInputsPage, &ConsolidateUnspentWizardSelectInputsPage::setAddressListSignal, + ui->selectDestinationPage, &ConsolidateUnspentWizardSelectDestinationPage::SetAddressList); - connect(ui->selectInputsPage, SIGNAL(setDefaultAddressSignal(QString)), - ui->selectDestinationPage, SLOT(setDefaultAddressSelection(QString))); + connect(ui->selectInputsPage, &ConsolidateUnspentWizardSelectInputsPage::setDefaultAddressSignal, + ui->selectDestinationPage, &ConsolidateUnspentWizardSelectDestinationPage::setDefaultAddressSelection); - connect(this->button(QWizard::FinishButton), SIGNAL(clicked()), ui->sendPage, SLOT(onFinishButtonClicked())); - connect(ui->sendPage, SIGNAL(selectedConsolidationRecipientSignal(SendCoinsRecipient)), - this, SIGNAL(selectedConsolidationRecipientSignal(SendCoinsRecipient))); + connect(this->button(QWizard::FinishButton), &QAbstractButton::clicked, + ui->sendPage, &ConsolidateUnspentWizardSendPage::onFinishButtonClicked); + connect(ui->sendPage, &ConsolidateUnspentWizardSendPage::selectedConsolidationRecipientSignal, + this, &ConsolidateUnspentWizard::selectedConsolidationRecipientSignal); } ConsolidateUnspentWizard::~ConsolidateUnspentWizard() diff --git a/src/qt/consolidateunspentwizardselectdestinationpage.cpp b/src/qt/consolidateunspentwizardselectdestinationpage.cpp index 238feae3a1..e5dff08ea4 100644 --- a/src/qt/consolidateunspentwizardselectdestinationpage.cpp +++ b/src/qt/consolidateunspentwizardselectdestinationpage.cpp @@ -12,7 +12,8 @@ ConsolidateUnspentWizardSelectDestinationPage::ConsolidateUnspentWizardSelectDes ui->addressTableWidget->setSelectionMode(QAbstractItemView::SingleSelection); // destination address selection - connect(ui->addressTableWidget, SIGNAL(itemSelectionChanged()), this, SLOT(addressSelectionChanged())); + connect(ui->addressTableWidget, &QTableWidget::itemSelectionChanged, + this, &ConsolidateUnspentWizardSelectDestinationPage::addressSelectionChanged); ui->isCompleteCheckBox->hide(); diff --git a/src/qt/consolidateunspentwizardselectinputspage.cpp b/src/qt/consolidateunspentwizardselectinputspage.cpp index f35fb4e17c..87c4c68b53 100644 --- a/src/qt/consolidateunspentwizardselectinputspage.cpp +++ b/src/qt/consolidateunspentwizardselectinputspage.cpp @@ -23,27 +23,27 @@ ConsolidateUnspentWizardSelectInputsPage::ConsolidateUnspentWizardSelectInputsPa ui->setupUi(this); // toggle tree/list mode - connect(ui->treeModeRadioButton, SIGNAL(toggled(bool)), this, SLOT(treeModeRadioButton(bool))); - connect(ui->listModeRadioButton, SIGNAL(toggled(bool)), this, SLOT(listModeRadioButton(bool))); + connect(ui->treeModeRadioButton, &QRadioButton::toggled, this, &ConsolidateUnspentWizardSelectInputsPage::treeModeRadioButton); + connect(ui->listModeRadioButton, &QRadioButton::toggled, this, &ConsolidateUnspentWizardSelectInputsPage::listModeRadioButton); // click on checkbox - connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(viewItemChanged(QTreeWidgetItem*, int))); + connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &ConsolidateUnspentWizardSelectInputsPage::viewItemChanged); // click on header ui->treeWidget->header()->setSectionsClickable(true); - connect(ui->treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(headerSectionClicked(int))); + connect(ui->treeWidget->header(), &QHeaderView::sectionClicked, this, &ConsolidateUnspentWizardSelectInputsPage::headerSectionClicked); // (un)select all - connect(ui->selectAllPushButton, SIGNAL(clicked()), this, SLOT(buttonSelectAllClicked())); + connect(ui->selectAllPushButton, &QPushButton::clicked, this, &ConsolidateUnspentWizardSelectInputsPage::buttonSelectAllClicked); // filter/consolidate button interaction - connect(ui->maxMinOutputValue, SIGNAL(textChanged()), this, SLOT(maxMinOutputValueChanged())); + connect(ui->maxMinOutputValue, &BitcoinAmountField::textChanged, this, &ConsolidateUnspentWizardSelectInputsPage::maxMinOutputValueChanged); // filter mode - connect(ui->filterModePushButton, SIGNAL(clicked()), this, SLOT(buttonFilterModeClicked())); + connect(ui->filterModePushButton, &QPushButton::clicked, this, &ConsolidateUnspentWizardSelectInputsPage::buttonFilterModeClicked); // filter - connect(ui->filterPushButton, SIGNAL(clicked()), this, SLOT(buttonFilterClicked())); + connect(ui->filterPushButton, &QPushButton::clicked, this, &ConsolidateUnspentWizardSelectInputsPage::buttonFilterClicked); ui->treeWidget->setColumnWidth(COLUMN_CHECKBOX, 150); ui->treeWidget->setColumnWidth(COLUMN_AMOUNT, 170); diff --git a/src/qt/diagnosticsdialog.cpp b/src/qt/diagnosticsdialog.cpp index 4faa7c71be..d36d8f15bc 100644 --- a/src/qt/diagnosticsdialog.cpp +++ b/src/qt/diagnosticsdialog.cpp @@ -406,16 +406,21 @@ void DiagnosticsDialog::VerifyClock(unsigned int connections) QTimer *timerVerifyClock = new QTimer(); // Set up a timeout clock of 10 seconds as a fail-safe. - connect(timerVerifyClock, SIGNAL(timeout()), this, SLOT(clkFinished())); + connect(timerVerifyClock, &QTimer::timeout, this, &DiagnosticsDialog::clkFinished); timerVerifyClock->start(10 * 1000); QHostInfo NTPHost = QHostInfo::fromName("pool.ntp.org"); m_udpSocket = new QUdpSocket(this); - connect(m_udpSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, - SLOT(clkStateChanged(QAbstractSocket::SocketState))); - connect(m_udpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, - SLOT(clkSocketError())); + connect(m_udpSocket, &QUdpSocket::stateChanged, this, &DiagnosticsDialog::clkStateChanged); + + // For Qt 5.15 and above QAbstractSocket::error has been deprecated in favor of errorOccurred. +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) + connect(m_udpSocket, static_cast(&QUdpSocket::error), + this, static_cast(&DiagnosticsDialog::clkSocketError)); +#else + connect(m_udpSocket, &QUdpSocket::errorOccurred, this, &DiagnosticsDialog::clkSocketError); +#endif if (!NTPHost.addresses().empty()) { @@ -431,7 +436,7 @@ void DiagnosticsDialog::clkStateChanged(QAbstractSocket::SocketState state) { if (state == QAbstractSocket::ConnectedState) { - connect(m_udpSocket, SIGNAL(readyRead()), this, SLOT(clkFinished())); + connect(m_udpSocket, &QUdpSocket::readyRead, this, &DiagnosticsDialog::clkFinished); char NTPMessage[48] = {0x1b, 0, 0, 0 ,0, 0, 0, 0, 0}; @@ -539,8 +544,16 @@ void DiagnosticsDialog::VerifyTCPPort() m_tcpSocket = new QTcpSocket(this); - connect(m_tcpSocket, SIGNAL(connected()), this, SLOT(TCPFinished())); - connect(m_tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(TCPFailed(QAbstractSocket::SocketError))); + connect(m_tcpSocket, &QTcpSocket::connected, this, &DiagnosticsDialog::TCPFinished); + + // For Qt 5.15 and above QAbstractSocket::error has been deprecated in favor of errorOccurred. +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) + connect(m_tcpSocket, static_cast(&QTcpSocket::error), + this, static_cast(&DiagnosticsDialog::TCPFailed)); +#else + connect(m_tcpSocket, static_cast(&QTcpSocket::errorOccurred), + this, static_cast(&DiagnosticsDialog::TCPFailed)); +#endif m_tcpSocket->connectToHost("portquiz.net", GetListenPort()); } diff --git a/src/qt/favoritespage.cpp b/src/qt/favoritespage.cpp index 1d3fa32fb6..7db0150fd7 100644 --- a/src/qt/favoritespage.cpp +++ b/src/qt/favoritespage.cpp @@ -48,7 +48,7 @@ void FavoritesPage::setOptionsModel(OptionsModel* model) addressBookPage->setOptionsModel(model); if (model) { - connect(model, SIGNAL(walletStylesheetChanged(QString)), this, SLOT(updateIcons(QString))); + connect(model, &OptionsModel::walletStylesheetChanged, this, &FavoritesPage::updateIcons); updateIcons(model->getCurrentStyle()); } } diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 1f32611055..6c70cf26ce 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -42,10 +42,10 @@ OptionsDialog::OptionsDialog(QWidget* parent) ui->socksVersion->addItem("4", 4); ui->socksVersion->setCurrentIndex(0); - connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool))); - connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool))); - connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->socksVersion, SLOT(setEnabled(bool))); - connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning_Proxy())); + connect(ui->connectSocks, &QPushButton::toggled, ui->proxyIp, &QWidget::setEnabled); + connect(ui->connectSocks, &QPushButton::toggled, ui->proxyPort, &QWidget::setEnabled); + connect(ui->connectSocks, &QPushButton::toggled, ui->socksVersion, &QWidget::setEnabled); + connect(ui->connectSocks, &QPushButton::clicked, this, &OptionsDialog::showRestartWarning_Proxy); ui->proxyIp->installEventFilter(this); ui->stakingEfficiency->installEventFilter(this); @@ -102,26 +102,23 @@ OptionsDialog::OptionsDialog(QWidget* parent) mapper->setOrientation(Qt::Vertical); /* enable apply button when data modified */ - connect(mapper, SIGNAL(viewModified()), this, SLOT(enableApplyButton())); + connect(mapper, &MonitoredDataMapper::viewModified, this, &OptionsDialog::enableApplyButton); /* disable apply button when new data loaded */ - connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableApplyButton())); + connect(mapper, &MonitoredDataMapper::currentIndexChanged, this, &OptionsDialog::disableApplyButton); /* setup/change UI elements when proxy IP, stakingEfficiency, or minStakeSplitValue is invalid/valid */ - connect(this, SIGNAL(proxyIpValid(QValidatedLineEdit *, bool)), - this, SLOT(handleProxyIpValid(QValidatedLineEdit *, bool))); - connect(this, SIGNAL(stakingEfficiencyValid(QValidatedLineEdit *, bool)), - this, SLOT(handleStakingEfficiencyValid(QValidatedLineEdit *, bool))); - connect(this, SIGNAL(minStakeSplitValueValid(QValidatedLineEdit *, bool)), - this, SLOT(handleMinStakeSplitValueValid(QValidatedLineEdit *, bool))); + connect(this, &OptionsDialog::proxyIpValid, this, &OptionsDialog::handleProxyIpValid); + connect(this, &OptionsDialog::stakingEfficiencyValid, this, &OptionsDialog::handleStakingEfficiencyValid); + connect(this, &OptionsDialog::minStakeSplitValueValid, this, &OptionsDialog::handleMinStakeSplitValueValid); if (fTestNet) ui->disableUpdateCheck->setHidden(true); ui->gridcoinAtStartupMinimised->setHidden(!ui->gridcoinAtStartup->isChecked()); ui->limitTxnDisplayDateEdit->setHidden(!ui->limitTxnDisplayCheckBox->isChecked()); - connect(ui->gridcoinAtStartup, SIGNAL(toggled(bool)), this, SLOT(hideStartMinimized())); - connect(ui->gridcoinAtStartupMinimised, SIGNAL(toggled(bool)), this, SLOT(hideStartMinimized())); + connect(ui->gridcoinAtStartup, &QCheckBox::toggled, this, &OptionsDialog::hideStartMinimized); + connect(ui->gridcoinAtStartupMinimised, &QCheckBox::toggled, this, &OptionsDialog::hideStartMinimized); - connect(ui->limitTxnDisplayCheckBox, SIGNAL(toggled(bool)), this, SLOT(hideLimitTxnDisplayDate())); + connect(ui->limitTxnDisplayCheckBox, &QCheckBox::toggled, this, &OptionsDialog::hideLimitTxnDisplayDate); bool stake_split_enabled = ui->enableStakeSplit->isChecked(); @@ -130,7 +127,7 @@ OptionsDialog::OptionsDialog(QWidget* parent) ui->minPostSplitOutputValueLabel->setHidden(!stake_split_enabled); ui->minPostSplitOutputValue->setHidden(!stake_split_enabled); - connect(ui->enableStakeSplit, SIGNAL(toggled(bool)), this, SLOT(hideStakeSplitting())); + connect(ui->enableStakeSplit, &QCheckBox::toggled, this, &OptionsDialog::hideStakeSplitting); } OptionsDialog::~OptionsDialog() @@ -144,7 +141,7 @@ void OptionsDialog::setModel(OptionsModel *model) if(model) { - connect(model, SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + connect(model, &OptionsModel::displayUnitChanged, this, &OptionsDialog::updateDisplayUnit); mapper->setModel(model); setMapper(); @@ -157,7 +154,8 @@ void OptionsDialog::setModel(OptionsModel *model) updateStyle(); /* warn only when language selection changes by user action (placed here so init via mapper doesn't trigger this) */ - connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning_Lang())); + connect(ui->lang, static_cast(&QValueComboBox::valueChanged), + this, &OptionsDialog::showRestartWarning_Lang); /* disable apply button after settings are loaded as there is nothing to save */ disableApplyButton(); diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index fa7dfc8a89..31cb2b2666 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -156,8 +156,8 @@ OverviewPage::OverviewPage(QWidget *parent) : ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false); updateTransactions(); - connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex))); - connect(ui->currentPollsTitleLabel, SIGNAL(clicked()), this, SLOT(handlePollLabelClicked())); + connect(ui->listTransactions, &QListView::clicked, this, &OverviewPage::handleTransactionClicked); + connect(ui->currentPollsTitleLabel, &ClickLabel::clicked, this, &OverviewPage::handlePollLabelClicked); // init "out of sync" warning labels ui->walletStatusLabel->setText(tr("Out of Sync")); @@ -306,11 +306,11 @@ void OverviewPage::setResearcherModel(ResearcherModel *researcherModel) } updateResearcherStatus(); - connect(researcherModel, SIGNAL(researcherChanged()), this, SLOT(updateResearcherStatus())); - connect(researcherModel, SIGNAL(magnitudeChanged()), this, SLOT(updateMagnitude())); - connect(researcherModel, SIGNAL(accrualChanged()), this, SLOT(updatePendingAccrual())); - connect(researcherModel, SIGNAL(beaconChanged()), this, SLOT(updateResearcherAlert())); - connect(ui->researcherConfigToolButton, SIGNAL(clicked()), this, SLOT(onBeaconButtonClicked())); + connect(researcherModel, &ResearcherModel::researcherChanged, this, &OverviewPage::updateResearcherStatus); + connect(researcherModel, &ResearcherModel::magnitudeChanged, this, &OverviewPage::updateMagnitude); + connect(researcherModel, &ResearcherModel::accrualChanged, this, &OverviewPage::updatePendingAccrual); + connect(researcherModel, &ResearcherModel::beaconChanged, this, &OverviewPage::updateResearcherAlert); + connect(ui->researcherConfigToolButton, &QAbstractButton::clicked, this, &OverviewPage::onBeaconButtonClicked); } void OverviewPage::setWalletModel(WalletModel *model) @@ -331,12 +331,12 @@ void OverviewPage::setWalletModel(WalletModel *model) // Keep up to date with wallet setBalance(model->getBalance(), model->getStake(), model->getUnconfirmedBalance(), model->getImmatureBalance()); - connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64, qint64))); + connect(model, &WalletModel::balanceChanged, this, &OverviewPage::setBalance); - connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + connect(model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &OverviewPage::updateDisplayUnit); - connect(model->getOptionsModel(), SIGNAL(LimitTxnDisplayChanged(bool)), this, SLOT(updateTransactions())); - connect(model, SIGNAL(transactionUpdated()), this, SLOT(updateTransactions())); + connect(model->getOptionsModel(), &OptionsModel::LimitTxnDisplayChanged, this, &OverviewPage::updateTransactions); + connect(model, &WalletModel::transactionUpdated, this, &OverviewPage::updateTransactions); } // update the display unit, to not use the default ("BTC") diff --git a/src/qt/qrcodedialog.cpp b/src/qt/qrcodedialog.cpp index 2982a982c3..c96a3c54c1 100644 --- a/src/qt/qrcodedialog.cpp +++ b/src/qt/qrcodedialog.cpp @@ -42,7 +42,7 @@ void QRCodeDialog::setModel(OptionsModel *model) this->model = model; if (model) - connect(model, SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + connect(model, &OptionsModel::displayUnitChanged, this, &QRCodeDialog::updateDisplayUnit); // update the display unit, to not use the default ("BTC") updateDisplayUnit(); diff --git a/src/qt/qvalidatedlineedit.cpp b/src/qt/qvalidatedlineedit.cpp index 8ca230c9d7..f6b03c0853 100644 --- a/src/qt/qvalidatedlineedit.cpp +++ b/src/qt/qvalidatedlineedit.cpp @@ -5,7 +5,7 @@ QValidatedLineEdit::QValidatedLineEdit(QWidget *parent) : QLineEdit(parent), valid(true) { - connect(this, SIGNAL(textChanged(QString)), this, SLOT(markValid())); + connect(this, &QLineEdit::textChanged, this, &QValidatedLineEdit::markValid); } void QValidatedLineEdit::setValid(bool valid) diff --git a/src/qt/qvaluecombobox.cpp b/src/qt/qvaluecombobox.cpp index d7ce3d0130..ad7fdbebaf 100644 --- a/src/qt/qvaluecombobox.cpp +++ b/src/qt/qvaluecombobox.cpp @@ -3,7 +3,7 @@ QValueComboBox::QValueComboBox(QWidget *parent) : QComboBox(parent), role(Qt::UserRole) { - connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int))); + connect(this, static_cast(&QComboBox::currentIndexChanged), this, &QValueComboBox::handleSelectionChanged); } QVariant QValueComboBox::value() const diff --git a/src/qt/receivecoinspage.cpp b/src/qt/receivecoinspage.cpp index bb87c4babf..ca646b6c6a 100644 --- a/src/qt/receivecoinspage.cpp +++ b/src/qt/receivecoinspage.cpp @@ -48,7 +48,7 @@ void ReceiveCoinsPage::setOptionsModel(OptionsModel *model) addressBookPage->setOptionsModel(model); if (model) { - connect(model, SIGNAL(walletStylesheetChanged(QString)), this, SLOT(updateIcons(QString))); + connect(model, &OptionsModel::walletStylesheetChanged, this, &ReceiveCoinsPage::updateIcons); updateIcons(model->getCurrentStyle()); } } diff --git a/src/qt/researcher/researchermodel.cpp b/src/qt/researcher/researchermodel.cpp index f99c29044f..25b3b215d8 100644 --- a/src/qt/researcher/researchermodel.cpp +++ b/src/qt/researcher/researchermodel.cpp @@ -99,7 +99,7 @@ ResearcherModel::ResearcherModel() } QTimer *refresh_timer = new QTimer(this); - connect(refresh_timer, SIGNAL(timeout()), this, SLOT(refresh())); + connect(refresh_timer, &QTimer::timeout, this, &ResearcherModel::refresh); refresh_timer->start(30 * 1000); } diff --git a/src/qt/researcher/researcherwizard.cpp b/src/qt/researcher/researcherwizard.cpp index 26f8ca58a5..e1f57d82b3 100644 --- a/src/qt/researcher/researcherwizard.cpp +++ b/src/qt/researcher/researcherwizard.cpp @@ -51,24 +51,24 @@ ResearcherWizard::ResearcherWizard( // next to a specific page directly, it emits a signal that we wire up here // to change the page when requested: // - connect(ui->modePage, SIGNAL(detailLinkButtonClicked()), - this, SLOT(onDetailLinkButtonClicked())); + connect(ui->modePage, &ResearcherWizardModePage::detailLinkButtonClicked, + this, &ResearcherWizard::onDetailLinkButtonClicked); // This enables the "review beacon verification" button on the summary page // to switch the current page back to beacon authentication page. Since the // summary page cannot navigate back to specific pages directly, it emits a // signal that we wire up here to change the page when requested: // - connect(ui->summaryPage, SIGNAL(reviewBeaconAuthButtonClicked()), - this, SLOT(onReviewBeaconAuthButtonClicked())); + connect(ui->summaryPage, &ResearcherWizardSummaryPage::reviewBeaconAuthButtonClicked, + this, &ResearcherWizard::onReviewBeaconAuthButtonClicked); // This enables the beacon "renew" button on the summary page to switch the // current page back to beacon page. Since the summary page cannot navigate // back to a specific page directly, it emits a signal that we wire up here // to change the page when requested: // - connect(ui->summaryPage, SIGNAL(renewBeaconButtonClicked()), - this, SLOT(onRenewBeaconButtonClicked())); + connect(ui->summaryPage, &ResearcherWizardSummaryPage::renewBeaconButtonClicked, + this, &ResearcherWizard::onRenewBeaconButtonClicked); } ResearcherWizard::~ResearcherWizard() @@ -93,10 +93,10 @@ int ResearcherWizard::GetNextIdByMode(const int mode) void ResearcherWizard::configureStartOverButton() { setButtonText(START_OVER_BUTTON, tr("&Start Over")); - connect(this, SIGNAL(customButtonClicked(int)), - this, SLOT(onCustomButtonClicked(int))); - connect(this, SIGNAL(currentIdChanged(int)), - this, SLOT(setStartOverButtonVisibility(int))); + connect(this, &ResearcherWizard::customButtonClicked, + this, &ResearcherWizard::onCustomButtonClicked); + connect(this, &ResearcherWizard::currentIdChanged, + this, &ResearcherWizard::setStartOverButtonVisibility); } void ResearcherWizard::setStartOverButtonVisibility(int page_id) diff --git a/src/qt/researcher/researcherwizardauthpage.cpp b/src/qt/researcher/researcherwizardauthpage.cpp index f8f628484d..b5eaba2015 100644 --- a/src/qt/researcher/researcherwizardauthpage.cpp +++ b/src/qt/researcher/researcherwizardauthpage.cpp @@ -36,7 +36,7 @@ void ResearcherWizardAuthPage::setModel(ResearcherModel* researcher_model) return; } - connect(m_researcher_model, SIGNAL(researcherChanged()), this, SLOT(refresh())); + connect(m_researcher_model, &ResearcherModel::researcherChanged, this, &ResearcherWizardAuthPage::refresh); } void ResearcherWizardAuthPage::initializePage() diff --git a/src/qt/researcher/researcherwizardbeaconpage.cpp b/src/qt/researcher/researcherwizardbeaconpage.cpp index dee66fc47e..1a56bada8d 100644 --- a/src/qt/researcher/researcherwizardbeaconpage.cpp +++ b/src/qt/researcher/researcherwizardbeaconpage.cpp @@ -37,9 +37,9 @@ void ResearcherWizardBeaconPage::setModel( return; } - connect(m_researcher_model, SIGNAL(researcherChanged()), this, SLOT(refresh())); - connect(m_researcher_model, SIGNAL(beaconChanged()), this, SLOT(refresh())); - connect(ui->sendBeaconButton, SIGNAL(clicked()), this, SLOT(advertiseBeacon())); + connect(m_researcher_model, &ResearcherModel::researcherChanged, this, &ResearcherWizardBeaconPage::refresh); + connect(m_researcher_model, &ResearcherModel::beaconChanged, this, &ResearcherWizardBeaconPage::refresh); + connect(ui->sendBeaconButton, &QPushButton::clicked, this, &ResearcherWizardBeaconPage::advertiseBeacon); } void ResearcherWizardBeaconPage::initializePage() diff --git a/src/qt/researcher/researcherwizardmodedetailpage.cpp b/src/qt/researcher/researcherwizardmodedetailpage.cpp index 63a5445e6c..6a970c762a 100644 --- a/src/qt/researcher/researcherwizardmodedetailpage.cpp +++ b/src/qt/researcher/researcherwizardmodedetailpage.cpp @@ -42,8 +42,8 @@ void ResearcherWizardModeDetailPage::initializePage() ui->modeButtonGroup->setId(ui->poolRadioButton, ResearcherWizard::ModePool); ui->modeButtonGroup->setId(ui->investorRadioButton, ResearcherWizard::ModeInvestor); - connect(ui->modeButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), - this, SLOT(onModeChange())); + connect(ui->modeButtonGroup, static_cast(&QButtonGroup::buttonClicked), + this, &ResearcherWizardModeDetailPage::onModeChange); if (m_researcher_model->configuredForInvestorMode()) { ui->investorRadioButton->setChecked(true); diff --git a/src/qt/researcher/researcherwizardmodepage.cpp b/src/qt/researcher/researcherwizardmodepage.cpp index 054e319880..f2208e2b16 100644 --- a/src/qt/researcher/researcherwizardmodepage.cpp +++ b/src/qt/researcher/researcherwizardmodepage.cpp @@ -42,12 +42,12 @@ void ResearcherWizardModePage::initializePage() ui->modeButtonGroup->setId(ui->poolRadioButton, ResearcherWizard::ModePool); ui->modeButtonGroup->setId(ui->investorRadioButton, ResearcherWizard::ModeInvestor); - connect(ui->soloIconLabel, SIGNAL(clicked()), this, SLOT(selectSolo())); - connect(ui->soloRadioButton, SIGNAL(toggled(bool)), this, SLOT(selectSolo(bool))); - connect(ui->poolIconLabel, SIGNAL(clicked()), this, SLOT(selectPool())); - connect(ui->poolRadioButton, SIGNAL(toggled(bool)), this, SLOT(selectPool(bool))); - connect(ui->investorIconLabel, SIGNAL(clicked()), this, SLOT(selectInvestor())); - connect(ui->investorRadioButton, SIGNAL(toggled(bool)), this, SLOT(selectInvestor(bool))); + connect(ui->soloIconLabel, &ClickLabel::clicked, this, static_cast(&ResearcherWizardModePage::selectSolo)); + connect(ui->soloRadioButton, &QRadioButton::toggled, this, static_cast(&ResearcherWizardModePage::selectSolo)); + connect(ui->poolIconLabel, &ClickLabel::clicked, this, static_cast(&ResearcherWizardModePage::selectPool)); + connect(ui->poolRadioButton, &QRadioButton::toggled, this, static_cast(&ResearcherWizardModePage::selectPool)); + connect(ui->investorIconLabel, &ClickLabel::clicked, this, static_cast(&ResearcherWizardModePage::selectInvestor)); + connect(ui->investorRadioButton, &QRadioButton::toggled, this, static_cast(&ResearcherWizardModePage::selectInvestor)); if (m_researcher_model->configuredForInvestorMode()) { selectInvestor(); diff --git a/src/qt/researcher/researcherwizardpoolpage.cpp b/src/qt/researcher/researcherwizardpoolpage.cpp index f4e2a05f7f..2185be6df2 100644 --- a/src/qt/researcher/researcherwizardpoolpage.cpp +++ b/src/qt/researcher/researcherwizardpoolpage.cpp @@ -57,14 +57,14 @@ void ResearcherWizardPoolPage::initializePage() m_researcher_model->switchToPool(); - connect(ui->poolTableWidget, SIGNAL(cellClicked(int, int)), - this, SLOT(openLink(int, int))); + connect(ui->poolTableWidget, &QTableWidget::cellClicked, + this, &ResearcherWizardPoolPage::openLink); if (!m_wallet_model) { return; } - connect(ui->newAddressButton, SIGNAL(clicked()), this, SLOT(getNewAddress())); + connect(ui->newAddressButton, &QPushButton::clicked, this, &ResearcherWizardPoolPage::getNewAddress); } void ResearcherWizardPoolPage::openLink(int row, int column) const diff --git a/src/qt/researcher/researcherwizardpoolsummarypage.cpp b/src/qt/researcher/researcherwizardpoolsummarypage.cpp index e3c84036cc..2aa3251082 100644 --- a/src/qt/researcher/researcherwizardpoolsummarypage.cpp +++ b/src/qt/researcher/researcherwizardpoolsummarypage.cpp @@ -49,7 +49,7 @@ void ResearcherWizardPoolSummaryPage::setModel(ResearcherModel *model) ui->projectTableView->setModel(m_table_model); ui->projectTableView->hideColumn(ProjectTableModel::Magnitude); - connect(ui->refreshButton, SIGNAL(clicked()), this, SLOT(refresh())); + connect(ui->refreshButton, &QPushButton::clicked, this, &ResearcherWizardPoolSummaryPage::refresh); } void ResearcherWizardPoolSummaryPage::initializePage() diff --git a/src/qt/researcher/researcherwizardprojectspage.cpp b/src/qt/researcher/researcherwizardprojectspage.cpp index 519d8f016a..62a857939e 100644 --- a/src/qt/researcher/researcherwizardprojectspage.cpp +++ b/src/qt/researcher/researcherwizardprojectspage.cpp @@ -46,7 +46,7 @@ void ResearcherWizardProjectsPage::setModel(ResearcherModel *model) ui->projectTableView->setModel(m_table_model); ui->projectTableView->hideColumn(ProjectTableModel::Magnitude); - connect(ui->refreshButton, SIGNAL(clicked()), this, SLOT(refresh())); + connect(ui->refreshButton, &QPushButton::clicked, this, &ResearcherWizardProjectsPage::refresh); } void ResearcherWizardProjectsPage::initializePage() diff --git a/src/qt/researcher/researcherwizardsummarypage.cpp b/src/qt/researcher/researcherwizardsummarypage.cpp index de3e20591a..1ee10b9816 100644 --- a/src/qt/researcher/researcherwizardsummarypage.cpp +++ b/src/qt/researcher/researcherwizardsummarypage.cpp @@ -44,10 +44,10 @@ void ResearcherWizardSummaryPage::setModel(ResearcherModel *model) ui->projectTableView->setModel(m_table_model); - connect(model, SIGNAL(researcherChanged()), this, SLOT(refreshSummary())); - connect(model, SIGNAL(beaconChanged()), this, SLOT(refreshSummary())); - connect(ui->refreshButton, SIGNAL(clicked()), this, SLOT(reloadProjects())); - connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(onTabChanged(int))); + connect(model, &ResearcherModel::researcherChanged, this, &ResearcherWizardSummaryPage::refreshSummary); + connect(model, &ResearcherModel::beaconChanged, this, &ResearcherWizardSummaryPage::refreshSummary); + connect(ui->refreshButton, &QPushButton::clicked, this, &ResearcherWizardSummaryPage::reloadProjects); + connect(ui->tabWidget, &QTabWidget::currentChanged, this, &ResearcherWizardSummaryPage::onTabChanged); } void ResearcherWizardSummaryPage::initializePage() diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 5885d3d4cb..06ca7bcddf 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -231,7 +231,7 @@ RPCConsole::RPCConsole(QWidget *parent) : ui->lineEdit->installEventFilter(this); ui->messagesWidget->installEventFilter(this); - connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); + connect(ui->clearButton, &QPushButton::clicked, this, &RPCConsole::clear); // set OpenSSL version label ui->openSSLVersion->setText(SSLeay_version(SSLEAY_VERSION)); @@ -296,12 +296,12 @@ void RPCConsole::setClientModel(ClientModel *model) if(model && clientModel->getPeerTableModel() && clientModel->getBanTableModel()) { // Subscribe to information, replies, messages, errors - connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); - connect(model, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int))); - connect(model, SIGNAL(updateScraperLog(QString)), this, SLOT(displayScraperLogMessage(QString))); + connect(model, &ClientModel::numConnectionsChanged, this, &RPCConsole::setNumConnections); + connect(model, &ClientModel::numBlocksChanged, this, &RPCConsole::setNumBlocks); + connect(model, &ClientModel::updateScraperLog, this, &RPCConsole::displayScraperLogMessage); updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent()); - connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64))); + connect(model, &ClientModel::bytesChanged, this, &RPCConsole::updateTrafficStats); // set up peer table ui->peerWidget->setModel(model->getPeerTableModel()); @@ -536,18 +536,18 @@ void RPCConsole::startExecutor() executor->moveToThread(thread); // Notify executor when thread started (in executor thread) - connect(thread, SIGNAL(started()), executor, SLOT(start())); + connect(thread, &QThread::started, executor, &RPCExecutor::start); // Replies from executor object must go to this object - connect(executor, SIGNAL(reply(int,QString)), this, SLOT(message(int,QString))); + connect(executor, &RPCExecutor::reply, this, [this](int cat, const QString &msg){this->message(cat, msg);}); // Requests from this object must go to executor - connect(this, SIGNAL(cmdRequest(QString)), executor, SLOT(request(QString))); + connect(this, &RPCConsole::cmdRequest, executor, &RPCExecutor::request); // On stopExecutor signal // - queue executor for deletion (in execution thread) // - quit the Qt event loop in the execution thread - connect(this, SIGNAL(stopExecutor()), executor, SLOT(deleteLater())); - connect(this, SIGNAL(stopExecutor()), thread, SLOT(quit())); + connect(this, &RPCConsole::stopExecutor, executor, &RPCExecutor::deleteLater); + connect(this, &RPCConsole::stopExecutor, thread, &QThread::quit); // Queue the thread for deletion (in this thread) when it is finished - connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); + connect(thread, &QThread::finished, thread, &QThread::deleteLater); // Default implementation of QThread::run() simply spins up an event loop in the thread, // which is what we want. diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 0475ae3abf..d6ab68c781 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -39,17 +39,17 @@ SendCoinsDialog::SendCoinsDialog(QWidget* parent) addEntry(); - connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addEntry())); - connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); + connect(ui->addButton, &QPushButton::clicked, this, &SendCoinsDialog::addEntry); + connect(ui->clearButton, &QPushButton::clicked, this, &SendCoinsDialog::clear); // Coin Control ui->coinControlChangeEdit->setFont(GUIUtil::bitcoinAddressFont()); - connect(ui->coinControlFeaturesButton, SIGNAL(clicked()), this, SLOT(toggleCoinControl())); - connect(ui->coinControlPushButton, SIGNAL(clicked()), this, SLOT(coinControlButtonClicked())); - connect(ui->coinControlConsolidateWizardPushButton, SIGNAL(clicked()), this, SLOT(coinControlConsolidateWizardButtonClicked())); - connect(ui->coinControlResetPushButton, SIGNAL(clicked()), this, SLOT(coinControlResetButtonClicked())); - connect(ui->coinControlChangeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(coinControlChangeChecked(int))); - connect(ui->coinControlChangeEdit, SIGNAL(textEdited(const QString &)), this, SLOT(coinControlChangeEdited(const QString &))); + connect(ui->coinControlFeaturesButton, &QPushButton::clicked, this, &SendCoinsDialog::toggleCoinControl); + connect(ui->coinControlPushButton, &QPushButton::clicked, this, &SendCoinsDialog::coinControlButtonClicked); + connect(ui->coinControlConsolidateWizardPushButton, &QPushButton::clicked, this, &SendCoinsDialog::coinControlConsolidateWizardButtonClicked); + connect(ui->coinControlResetPushButton, &QPushButton::clicked, this, &SendCoinsDialog::coinControlResetButtonClicked); + connect(ui->coinControlChangeCheckBox, &QCheckBox::stateChanged, this, &SendCoinsDialog::coinControlChangeChecked); + connect(ui->coinControlChangeEdit, &QLineEdit::textEdited, this, &SendCoinsDialog::coinControlChangeEdited); // Coin Control: clipboard actions QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this); @@ -60,14 +60,14 @@ SendCoinsDialog::SendCoinsDialog(QWidget* parent) QAction *clipboardPriorityAction = new QAction(tr("Copy priority"), this); QAction *clipboardLowOutputAction = new QAction(tr("Copy low output"), this); QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); - connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardQuantity())); - connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardAmount())); - connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardFee())); - connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardAfterFee())); - connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardBytes())); - connect(clipboardPriorityAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardPriority())); - connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardLowOutput())); - connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(coinControlClipboardChange())); + connect(clipboardQuantityAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardQuantity); + connect(clipboardAmountAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardAmount); + connect(clipboardFeeAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardFee); + connect(clipboardAfterFeeAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardAfterFee); + connect(clipboardBytesAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardBytes); + connect(clipboardPriorityAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardPriority); + connect(clipboardLowOutputAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardLowOutput); + connect(clipboardChangeAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardChange); ui->coinControlQuantityLabel->addAction(clipboardQuantityAction); ui->coinControlAmountLabel->addAction(clipboardAmountAction); ui->coinControlFeeLabel->addAction(clipboardFeeAction); @@ -92,18 +92,18 @@ void SendCoinsDialog::setModel(WalletModel *model) entry->setModel(model); } } - if(model && model->getOptionsModel()) + if (model && model->getOptionsModel()) { setBalance(model->getBalance(), model->getStake(), model->getUnconfirmedBalance(), model->getImmatureBalance()); - connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64, qint64))); - connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + connect(model, &WalletModel::balanceChanged, this, &SendCoinsDialog::setBalance); + connect(model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsDialog::updateDisplayUnit); // Update icons according to the stylesheet - connect(model->getOptionsModel(),SIGNAL(walletStylesheetChanged(QString)), this, SLOT(updateIcons())); + connect(model->getOptionsModel(), &OptionsModel::walletStylesheetChanged, this, &SendCoinsDialog::updateIcons); // Coin Control - connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(coinControlUpdateLabels())); - connect(model->getOptionsModel(), SIGNAL(coinControlFeaturesChanged(bool)), this, SLOT(coinControlFeatureChanged(bool))); + connect(model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsDialog::coinControlUpdateLabels); + connect(model->getOptionsModel(), &OptionsModel::coinControlFeaturesChanged, this, &SendCoinsDialog::coinControlFeatureChanged); ui->coinControlContentWidget->setVisible(model->getOptionsModel()->getCoinControlFeatures()); coinControlUpdateLabels(); @@ -261,8 +261,8 @@ SendCoinsEntry *SendCoinsDialog::addEntry() SendCoinsEntry *entry = new SendCoinsEntry(this); entry->setModel(model); ui->entries->addWidget(entry); - connect(entry, SIGNAL(removeEntry(SendCoinsEntry*)), this, SLOT(removeEntry(SendCoinsEntry*))); - connect(entry, SIGNAL(payAmountChanged()), this, SLOT(coinControlUpdateLabels())); + connect(entry, &SendCoinsEntry::removeEntry, this, &SendCoinsDialog::removeEntry); + connect(entry, &SendCoinsEntry::payAmountChanged, this, &SendCoinsDialog::coinControlUpdateLabels); updateRemoveEnabled(); @@ -457,8 +457,8 @@ void SendCoinsDialog::coinControlButtonClicked() CoinControlDialog dlg(this, coinControl, payAmounts); dlg.setModel(model); - connect(&dlg, SIGNAL(selectedConsolidationRecipientSignal(SendCoinsRecipient)), - this, SLOT(selectedConsolidationRecipient(SendCoinsRecipient))); + connect(&dlg, &CoinControlDialog::selectedConsolidationRecipientSignal, + this, &SendCoinsDialog::selectedConsolidationRecipient); dlg.exec(); coinControlUpdateLabels(); @@ -475,14 +475,14 @@ void SendCoinsDialog::coinControlConsolidateWizardButtonClicked() CoinControlDialog dlg(this, coinControl, payAmounts); dlg.setModel(model); - connect(&dlg, SIGNAL(selectedConsolidationRecipientSignal(SendCoinsRecipient)), - this, SLOT(selectedConsolidationRecipient(SendCoinsRecipient))); + connect(&dlg, &CoinControlDialog::selectedConsolidationRecipientSignal, + this, &SendCoinsDialog::selectedConsolidationRecipient); ConsolidateUnspentWizard wizard(this, coinControl, payAmounts); wizard.setModel(model); - connect(&wizard, SIGNAL(selectedConsolidationRecipientSignal(SendCoinsRecipient)), - this, SLOT(selectedConsolidationRecipient(SendCoinsRecipient))); + connect(&wizard, &ConsolidateUnspentWizard::selectedConsolidationRecipientSignal, + this, &SendCoinsDialog::selectedConsolidationRecipient); wizard.exec(); coinControlUpdateLabels(); diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index b947958a94..8321f7ff2a 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -65,12 +65,12 @@ void SendCoinsEntry::setModel(WalletModel *model) if(model && model->getOptionsModel()) { - connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); - connect(model->getOptionsModel(),SIGNAL(walletStylesheetChanged(QString)), this, SLOT(updateIcons())); + connect(model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsEntry::updateDisplayUnit); + connect(model->getOptionsModel(), &OptionsModel::walletStylesheetChanged, this, &SendCoinsEntry::updateIcons); // set the icons according to the style options updateIcons(); } - connect(ui->payAmount, SIGNAL(textChanged()), this, SIGNAL(payAmountChanged())); + connect(ui->payAmount, &BitcoinAmountField::textChanged, this, &SendCoinsEntry::payAmountChanged); clear(); } diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index b6c3e0be06..ed815e6ad5 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -26,7 +26,7 @@ TrafficGraphWidget::TrafficGraphWidget(QWidget* parent) , clientModel(nullptr) { timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), SLOT(updateRates())); + connect(timer, &QTimer::timeout, this, &TrafficGraphWidget::updateRates); } void TrafficGraphWidget::setClientModel(ClientModel *model) diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index f9688eb21e..5ba2cac455 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -264,8 +264,8 @@ TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel *paren priv->loadWallet(); - connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); - connect(walletModel->getOptionsModel(), SIGNAL(LimitTxnDisplayChanged(bool)), this, SLOT(refreshWallet())); + connect(walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &TransactionTableModel::updateDisplayUnit); + connect(walletModel->getOptionsModel(), &OptionsModel::LimitTxnDisplayChanged, this, &TransactionTableModel::refreshWallet); } TransactionTableModel::~TransactionTableModel() diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 1b4aa1b057..ed99b8cbbf 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -143,20 +143,20 @@ TransactionView::TransactionView(QWidget *parent) contextMenu->addAction(showDetailsAction); // Connect actions - connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int))); - connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int))); - connect(searchWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString))); - connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString))); - - connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex))); - connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); - - connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); - connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); - connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); - connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID())); - connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel())); - connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails())); + connect(dateWidget, static_cast(&QComboBox::activated), this, &TransactionView::chooseDate); + connect(typeWidget, static_cast(&QComboBox::activated), this, &TransactionView::chooseType); + connect(searchWidget, &QLineEdit::textChanged, this, &TransactionView::changedPrefix); + connect(amountWidget, &QLineEdit::textChanged, this, &TransactionView::changedAmount); + + connect(view, &QTableView::doubleClicked, this, &TransactionView::doubleClicked); + connect(view, &QWidget::customContextMenuRequested, this, &TransactionView::contextualMenu); + + connect(copyAddressAction, &QAction::triggered, this, &TransactionView::copyAddress); + connect(copyLabelAction, &QAction::triggered, this, &TransactionView::copyLabel); + connect(copyAmountAction, &QAction::triggered, this, &TransactionView::copyAmount); + connect(copyTxIDAction, &QAction::triggered, this, &TransactionView::copyTxID); + connect(editLabelAction, &QAction::triggered, this, &TransactionView::editLabel); + connect(showDetailsAction, &QAction::triggered, this, &TransactionView::showDetails); } void TransactionView::setModel(WalletModel *model) @@ -194,8 +194,8 @@ void TransactionView::setModel(WalletModel *model) if (model && model->getOptionsModel()) { connect( - model->getOptionsModel(), SIGNAL(walletStylesheetChanged(QString)), - this, SLOT(updateIcons(QString))); + model->getOptionsModel(), &OptionsModel::walletStylesheetChanged, + this, &TransactionView::updateIcons); updateIcons(model->getOptionsModel()->getCurrentStyle()); } } @@ -424,8 +424,8 @@ QWidget *TransactionView::createDateRangeWidget() dateRangeWidget->setVisible(false); // Notify on change - connect(dateFrom, SIGNAL(dateChanged(QDate)), this, SLOT(dateRangeChanged())); - connect(dateTo, SIGNAL(dateChanged(QDate)), this, SLOT(dateRangeChanged())); + connect(dateFrom, &QDateTimeEdit::dateChanged, this, &TransactionView::dateRangeChanged); + connect(dateTo, &QDateTimeEdit::dateChanged, this, &TransactionView::dateRangeChanged); return dateRangeWidget; } diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h index d4dee755e3..04810925ef 100644 --- a/src/qt/transactionview.h +++ b/src/qt/transactionview.h @@ -61,7 +61,6 @@ class TransactionView : public QFrame private slots: void contextualMenu(const QPoint &); void dateRangeChanged(); - void showDetails(); void copyAddress(); void editLabel(); void copyLabel(); @@ -73,6 +72,7 @@ private slots: void doubleClicked(const QModelIndex&); public slots: + void showDetails(); void chooseDate(int idx); void chooseType(int idx); void changedPrefix(const QString &prefix); diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index d6ddc30a84..da99bc0a7e 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -34,7 +34,7 @@ WalletModel::WalletModel(CWallet* wallet, OptionsModel* optionsModel, QObject* p // This timer will be fired repeatedly to update the balance pollTimer = new QTimer(this); - connect(pollTimer, SIGNAL(timeout()), this, SLOT(pollBalanceChanged())); + connect(pollTimer, &QTimer::timeout, this, &WalletModel::pollBalanceChanged); pollTimer->start(MODEL_UPDATE_DELAY); subscribeToCoreSignals();