-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Use new Qt5 connect syntax #13529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use new Qt5 connect syntax #13529
Conversation
Concept ACK. The new syntax has compile time checks, removing the need to debug impossible to find syntax errors during run time. |
Concept ACK (because of @MarcoFalke's reasoning) |
Thanks, I'll complete it then. |
@MarcoFalke @laanwj see new lint script, it can be improved later with other checks related to Qt. I don't know of a Qt way to prevent the old syntax. |
Concept ACK |
1 similar comment
Concept ACK |
LGTM |
does this mean it's better to postpone this to a (far) future in which we can drop pre-5.7 support? |
Not really, until now just a couple of these where I have to cast the slot. |
oh if it can be worked around and is just a couple of cases, I agree it's not a big issue, just need to be careful to test all behavior afterwards. |
@promag What's the status of this? Would it be good to get into 0.17.0? |
42f59ce
to
4d54e33
Compare
@fanquake ready to review. |
@laanwj at the moment I count 25 cases. |
Note to reviewers: This pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
9443c85
to
9813bf1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK. I'm a big fan of compile time checks. The new syntax also helps readability because you no longer have to guess the class name (e.g. QTableView
) from the the variable name (e.g. ui->tableView
).
Found a few problems with ba34538 on macOS 10.13.6 though (Qt 5.11.1 and 5.9.6):
- application hides when I navigate to a new tab (e.g. from Overview to Transactions); maybe some event needs to be not propagated?
- all console window commands cause a segfault, so much for compile time checks :-(
Other than that I tested most connect
instances and they all seem to work.
I ran into a bunch of existing issues, none of which are end of the world, but they're a distraction when reviewing if you don't know about them.
src/qt/bitcoingui.cpp
Outdated
connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); | ||
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); | ||
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); | ||
connect(overviewAction, &QAction::triggered, this, &BitcoinGUI::showNormalIfMinimized); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you can actually reach this when the application is hidden, but that can be addressed another time.
src/qt/overviewpage.cpp
Outdated
connect(ui->labelWalletStatus, SIGNAL(clicked()), this, SLOT(handleOutOfSyncWarningClicks())); | ||
connect(ui->labelTransactionsStatus, SIGNAL(clicked()), this, SLOT(handleOutOfSyncWarningClicks())); | ||
connect(ui->labelWalletStatus, &QPushButton::clicked, this, &OverviewPage::handleOutOfSyncWarningClicks); | ||
connect(ui->labelWalletStatus, &QPushButton::clicked, this, &OverviewPage::handleOutOfSyncWarningClicks); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
connect(editLabelAction, &QAction::triggered, this, &TransactionView::editLabel); | ||
connect(showDetailsAction, &QAction::triggered, this, &TransactionView::showDetails); | ||
// Double-clicking on a transaction on the transaction history page shows details | ||
connect(this, &TransactionView::doubleClicked, this, &TransactionView::showDetails); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for other reviewers: this was moved from src/qt/walletview.cpp
@Sjors thanks for the review, I'll rebase and address your comments! |
de93a06
to
ac8661e
Compare
Can confirm these issues are fixed in ac8661e. |
ac8661e
to
01b5c26
Compare
Squashed and rebased. Thanks @Sjors! |
Needs rebase |
ehm... sorry, needs rebase again, if the remaining issues are solved we should merge this |
01b5c26
to
3567b24
Compare
3567b24 test: Add lint to prevent SIGNAL/SLOT connect style (João Barbosa) f78558f qt: Use new Qt5 connect syntax (João Barbosa) Pull request description: Pros&cons in https://wiki.qt.io/New_Signal_Slot_Syntax. Note that connecting to/from overloaded slot/signal is ugly before qt 5.7 (see https://stackoverflow.com/a/16795664). Tree-SHA512: ab81f035099fecd34be546f7091bc29595349f2fd0fea26f6414242702955fca27faa4fe19ebfe105c01217908b51db762cb5a9f6ce25bc5e8e6f64c77428c22
c54fd9d [Qt] Switch to newer connect syntax (Fuzzbawls) Pull request description: Switch all Qt connections to the newer functor-based syntax. Marked [WIP] for now until larger PRs can be merged. Mostly ported from bitcoin#13529 Requires the following PR to be merged first in order to adhere to standards: - [x] #1351 ACKs for top commit: furszy: ACK c54fd9d random-zebra: ACK c54fd9d and merging... Tree-SHA512: d5222264566a8920ab97e8c586f134156d9d0514d014b430bdd47a34b0620ab94a1c6d341b6a57322f1131a8fad91a5e1af907f3bd7112d0ab5e04c4cc9f5ae5
c54fd9dfded28f2b4ff86914422fb592bd86f320 [Qt] Switch to newer connect syntax (Fuzzbawls) Pull request description: Switch all Qt connections to the newer functor-based syntax. Marked [WIP] for now until larger PRs can be merged. Mostly ported from bitcoin/bitcoin#13529 Requires the following PR to be merged first in order to adhere to standards: - [x] #1351 ACKs for top commit: furszy: ACK c54fd9d random-zebra: ACK c54fd9dfded28f2b4ff86914422fb592bd86f320 and merging... Tree-SHA512: d5222264566a8920ab97e8c586f134156d9d0514d014b430bdd47a34b0620ab94a1c6d341b6a57322f1131a8fad91a5e1af907f3bd7112d0ab5e04c4cc9f5ae5 # Conflicts: # .travis/lint_06_script.sh # src/qt/optionsdialog.cpp # src/qt/rpcconsole.cpp # src/qt/vitae.cpp # src/qt/vitae/navmenuwidget.cpp # src/qt/vitae/privacywidget.cpp # src/qt/vitae/send.cpp
3567b24 test: Add lint to prevent SIGNAL/SLOT connect style (João Barbosa) f78558f qt: Use new Qt5 connect syntax (João Barbosa) Pull request description: Pros&cons in https://wiki.qt.io/New_Signal_Slot_Syntax. Note that connecting to/from overloaded slot/signal is ugly before qt 5.7 (see https://stackoverflow.com/a/16795664). Tree-SHA512: ab81f035099fecd34be546f7091bc29595349f2fd0fea26f6414242702955fca27faa4fe19ebfe105c01217908b51db762cb5a9f6ce25bc5e8e6f64c77428c22
3567b24 test: Add lint to prevent SIGNAL/SLOT connect style (João Barbosa) f78558f qt: Use new Qt5 connect syntax (João Barbosa) Pull request description: Pros&cons in https://wiki.qt.io/New_Signal_Slot_Syntax. Note that connecting to/from overloaded slot/signal is ugly before qt 5.7 (see https://stackoverflow.com/a/16795664). Tree-SHA512: ab81f035099fecd34be546f7091bc29595349f2fd0fea26f6414242702955fca27faa4fe19ebfe105c01217908b51db762cb5a9f6ce25bc5e8e6f64c77428c22
Pros&cons in https://wiki.qt.io/New_Signal_Slot_Syntax.
Note that connecting to/from overloaded slot/signal is ugly before qt 5.7 (see https://stackoverflow.com/a/16795664).