Skip to content

Commit f78558f

Browse files
committed
qt: Use new Qt5 connect syntax
1 parent 8aa9bad commit f78558f

33 files changed

+304
-304
lines changed

src/qt/addressbookpage.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode,
8585
case SendingTab: setWindowTitle(tr("Choose the address to send coins to")); break;
8686
case ReceivingTab: setWindowTitle(tr("Choose the address to receive coins with")); break;
8787
}
88-
connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept()));
88+
connect(ui->tableView, &QTableView::doubleClicked, this, &QDialog::accept);
8989
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
9090
ui->tableView->setFocus();
9191
ui->closeButton->setText(tr("C&hoose"));
@@ -129,14 +129,14 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode,
129129
contextMenu->addSeparator();
130130

131131
// Connect signals for context menu actions
132-
connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(on_copyAddress_clicked()));
133-
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(onCopyLabelAction()));
134-
connect(editAction, SIGNAL(triggered()), this, SLOT(onEditAction()));
135-
connect(deleteAction, SIGNAL(triggered()), this, SLOT(on_deleteAddress_clicked()));
132+
connect(copyAddressAction, &QAction::triggered, this, &AddressBookPage::on_copyAddress_clicked);
133+
connect(copyLabelAction, &QAction::triggered, this, &AddressBookPage::onCopyLabelAction);
134+
connect(editAction, &QAction::triggered, this, &AddressBookPage::onEditAction);
135+
connect(deleteAction, &QAction::triggered, this, &AddressBookPage::on_deleteAddress_clicked);
136136

137-
connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));
137+
connect(ui->tableView, &QWidget::customContextMenuRequested, this, &AddressBookPage::contextualMenu);
138138

139-
connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(accept()));
139+
connect(ui->closeButton, &QPushButton::clicked, this, &QDialog::accept);
140140
}
141141

142142
AddressBookPage::~AddressBookPage()
@@ -154,7 +154,7 @@ void AddressBookPage::setModel(AddressTableModel *_model)
154154
proxyModel = new AddressBookSortFilterProxyModel(type, this);
155155
proxyModel->setSourceModel(_model);
156156

157-
connect(ui->searchLineEdit, SIGNAL(textChanged(QString)), proxyModel, SLOT(setFilterWildcard(QString)));
157+
connect(ui->searchLineEdit, &QLineEdit::textChanged, proxyModel, &QSortFilterProxyModel::setFilterWildcard);
158158

159159
ui->tableView->setModel(proxyModel);
160160
ui->tableView->sortByColumn(0, Qt::AscendingOrder);
@@ -163,11 +163,11 @@ void AddressBookPage::setModel(AddressTableModel *_model)
163163
ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Label, QHeaderView::Stretch);
164164
ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents);
165165

166-
connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
167-
this, SLOT(selectionChanged()));
166+
connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged,
167+
this, &AddressBookPage::selectionChanged);
168168

169169
// Select row for newly created address
170-
connect(_model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(selectNewAddress(QModelIndex,int,int)));
170+
connect(_model, &AddressTableModel::rowsInserted, this, &AddressBookPage::selectNewAddress);
171171

172172
selectionChanged();
173173
}

src/qt/askpassphrasedialog.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent) :
7070
break;
7171
}
7272
textChanged();
73-
connect(ui->toggleShowPasswordButton, SIGNAL(toggled(bool)), this, SLOT(toggleShowPassword(bool)));
74-
connect(ui->passEdit1, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
75-
connect(ui->passEdit2, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
76-
connect(ui->passEdit3, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
73+
connect(ui->toggleShowPasswordButton, &QPushButton::toggled, this, &AskPassphraseDialog::toggleShowPassword);
74+
connect(ui->passEdit1, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged);
75+
connect(ui->passEdit2, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged);
76+
connect(ui->passEdit3, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged);
7777
}
7878

7979
AskPassphraseDialog::~AskPassphraseDialog()

src/qt/bitcoin.cpp

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
353353
window = new BitcoinGUI(m_node, platformStyle, networkStyle, 0);
354354

355355
pollShutdownTimer = new QTimer(window);
356-
connect(pollShutdownTimer, SIGNAL(timeout()), window, SLOT(detectShutdown()));
356+
connect(pollShutdownTimer, &QTimer::timeout, window, &BitcoinGUI::detectShutdown);
357357
}
358358

359359
void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle)
@@ -362,8 +362,8 @@ void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle)
362362
// We don't hold a direct pointer to the splash screen after creation, but the splash
363363
// screen will take care of deleting itself when slotFinish happens.
364364
splash->show();
365-
connect(this, SIGNAL(splashFinished(QWidget*)), splash, SLOT(slotFinish(QWidget*)));
366-
connect(this, SIGNAL(requestedShutdown()), splash, SLOT(close()));
365+
connect(this, &BitcoinApplication::splashFinished, splash, &SplashScreen::slotFinish);
366+
connect(this, &BitcoinApplication::requestedShutdown, splash, &QWidget::close);
367367
}
368368

369369
void BitcoinApplication::startThread()
@@ -375,14 +375,14 @@ void BitcoinApplication::startThread()
375375
executor->moveToThread(coreThread);
376376

377377
/* communication to and from thread */
378-
connect(executor, SIGNAL(initializeResult(bool)), this, SLOT(initializeResult(bool)));
379-
connect(executor, SIGNAL(shutdownResult()), this, SLOT(shutdownResult()));
380-
connect(executor, SIGNAL(runawayException(QString)), this, SLOT(handleRunawayException(QString)));
381-
connect(this, SIGNAL(requestedInitialize()), executor, SLOT(initialize()));
382-
connect(this, SIGNAL(requestedShutdown()), executor, SLOT(shutdown()));
378+
connect(executor, &BitcoinCore::initializeResult, this, &BitcoinApplication::initializeResult);
379+
connect(executor, &BitcoinCore::shutdownResult, this, &BitcoinApplication::shutdownResult);
380+
connect(executor, &BitcoinCore::runawayException, this, &BitcoinApplication::handleRunawayException);
381+
connect(this, &BitcoinApplication::requestedInitialize, executor, &BitcoinCore::initialize);
382+
connect(this, &BitcoinApplication::requestedShutdown, executor, &BitcoinCore::shutdown);
383383
/* make sure executor object is deleted in its own thread */
384-
connect(this, SIGNAL(stopThread()), executor, SLOT(deleteLater()));
385-
connect(this, SIGNAL(stopThread()), coreThread, SLOT(quit()));
384+
connect(this, &BitcoinApplication::stopThread, executor, &QObject::deleteLater);
385+
connect(this, &BitcoinApplication::stopThread, coreThread, &QThread::quit);
386386

387387
coreThread->start();
388388
}
@@ -442,9 +442,9 @@ void BitcoinApplication::addWallet(WalletModel* walletModel)
442442
window->setCurrentWallet(walletModel->getWalletName());
443443
}
444444

445-
connect(walletModel, SIGNAL(coinsSent(WalletModel*, SendCoinsRecipient, QByteArray)),
446-
paymentServer, SLOT(fetchPaymentACK(WalletModel*, const SendCoinsRecipient&, QByteArray)));
447-
connect(walletModel, SIGNAL(unload()), this, SLOT(removeWallet()));
445+
connect(walletModel, &WalletModel::coinsSent,
446+
paymentServer, &PaymentServer::fetchPaymentACK);
447+
connect(walletModel, &WalletModel::unload, this, &BitcoinApplication::removeWallet);
448448

449449
m_wallet_models.push_back(walletModel);
450450
#endif
@@ -504,13 +504,12 @@ void BitcoinApplication::initializeResult(bool success)
504504
#ifdef ENABLE_WALLET
505505
// Now that initialization/startup is done, process any command-line
506506
// bitcoin: URIs or payment requests:
507-
connect(paymentServer, SIGNAL(receivedPaymentRequest(SendCoinsRecipient)),
508-
window, SLOT(handlePaymentRequest(SendCoinsRecipient)));
509-
connect(window, SIGNAL(receivedURI(QString)),
510-
paymentServer, SLOT(handleURIOrFile(QString)));
511-
connect(paymentServer, SIGNAL(message(QString,QString,unsigned int)),
512-
window, SLOT(message(QString,QString,unsigned int)));
513-
QTimer::singleShot(100, paymentServer, SLOT(uiReady()));
507+
connect(paymentServer, &PaymentServer::receivedPaymentRequest, window, &BitcoinGUI::handlePaymentRequest);
508+
connect(window, &BitcoinGUI::receivedURI, paymentServer, &PaymentServer::handleURIOrFile);
509+
connect(paymentServer, &PaymentServer::message, [this](const QString& title, const QString& message, unsigned int style) {
510+
window->message(title, message, style);
511+
});
512+
QTimer::singleShot(100, paymentServer, &PaymentServer::uiReady);
514513
#endif
515514
pollShutdownTimer->start(200);
516515
} else {

src/qt/bitcoinamountfield.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AmountSpinBox: public QAbstractSpinBox
2929
{
3030
setAlignment(Qt::AlignRight);
3131

32-
connect(lineEdit(), SIGNAL(textEdited(QString)), this, SIGNAL(valueChanged()));
32+
connect(lineEdit(), &QLineEdit::textEdited, this, &AmountSpinBox::valueChanged);
3333
}
3434

3535
QValidator::State validate(QString &text, int &pos) const
@@ -213,8 +213,8 @@ BitcoinAmountField::BitcoinAmountField(QWidget *parent) :
213213
setFocusProxy(amount);
214214

215215
// If one if the widgets changes, the combined content changes as well
216-
connect(amount, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
217-
connect(unit, SIGNAL(currentIndexChanged(int)), this, SLOT(unitChanged(int)));
216+
connect(amount, &AmountSpinBox::valueChanged, this, &BitcoinAmountField::valueChanged);
217+
connect(unit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &BitcoinAmountField::unitChanged);
218218

219219
// Set default based on configuration
220220
unitChanged(unit->currentIndex());

0 commit comments

Comments
 (0)