Skip to content

Conversation

promag
Copy link
Contributor

@promag promag commented Jun 24, 2018

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).

@maflcko
Copy link
Member

maflcko commented Jun 24, 2018

Concept ACK. The new syntax has compile time checks, removing the need to debug impossible to find syntax errors during run time.

@laanwj
Copy link
Member

laanwj commented Jun 24, 2018

Concept ACK (because of @MarcoFalke's reasoning)
Would make sense to change all of these at once.

@promag
Copy link
Contributor Author

promag commented Jun 24, 2018

Thanks, I'll complete it then.

@promag
Copy link
Contributor Author

promag commented Jun 24, 2018

@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.

@jonasschnelli
Copy link
Contributor

Concept ACK

1 similar comment
@fanquake
Copy link
Member

fanquake commented Jul 1, 2018

Concept ACK

@laanwj
Copy link
Member

laanwj commented Jul 5, 2018

see new lint script, it can be improved later with other checks related to Qt

LGTM

@laanwj
Copy link
Member

laanwj commented Jul 10, 2018

  • found a connection to a private slot that doesn't work with the new syntax.
  • connection to/from overloaded slot/signal is ugly before qt 5.7 (see https://stackoverflow.com/a/16795664)

does this mean it's better to postpone this to a (far) future in which we can drop pre-5.7 support?

@promag
Copy link
Contributor Author

promag commented Jul 10, 2018

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.

@laanwj
Copy link
Member

laanwj commented Jul 10, 2018

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.

@fanquake
Copy link
Member

@promag What's the status of this? Would it be good to get into 0.17.0?

@promag promag force-pushed the 2018-06-use-qt5-connect-syntax branch 5 times, most recently from 42f59ce to 4d54e33 Compare July 22, 2018 00:41
@promag promag changed the title wip: Use new Qt5 connect syntax Use new Qt5 connect syntax Jul 22, 2018
@promag
Copy link
Contributor Author

promag commented Jul 22, 2018

@fanquake ready to review.

@promag
Copy link
Contributor Author

promag commented Jul 22, 2018

oh if it can be worked around and is just a couple of cases

@laanwj at the moment I count 25 cases.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 22, 2018

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.

@promag promag force-pushed the 2018-06-use-qt5-connect-syntax branch 2 times, most recently from 9443c85 to 9813bf1 Compare July 23, 2018 09:54
@laanwj laanwj added this to the 0.18.0 milestone Jul 23, 2018
Copy link
Member

@Sjors Sjors left a 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.

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);
Copy link
Member

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.

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate line

Copy link
Contributor Author

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);
Copy link
Member

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

@promag
Copy link
Contributor Author

promag commented Aug 16, 2018

@Sjors thanks for the review, I'll rebase and address your comments!

@promag promag force-pushed the 2018-06-use-qt5-connect-syntax branch 2 times, most recently from de93a06 to ac8661e Compare August 20, 2018 00:31
@promag
Copy link
Contributor Author

promag commented Aug 20, 2018

all console window commands cause a segfault, so much for compile time checks :-(

@Sjors fixed in 5261ab0.

application hides when I navigate to a new tab (e.g. from Overview to Transactions); maybe some event needs to be not propagated?

Fixed in ac8661e.

@Sjors
Copy link
Member

Sjors commented Aug 20, 2018

Can confirm these issues are fixed in ac8661e.

@promag promag force-pushed the 2018-06-use-qt5-connect-syntax branch from ac8661e to 01b5c26 Compare August 20, 2018 17:07
@promag
Copy link
Contributor Author

promag commented Aug 20, 2018

Squashed and rebased. Thanks @Sjors!

@DrahtBot
Copy link
Contributor

Needs rebase

@laanwj
Copy link
Member

laanwj commented Aug 21, 2018

ehm... sorry, needs rebase again, if the remaining issues are solved we should merge this

@promag promag force-pushed the 2018-06-use-qt5-connect-syntax branch from 01b5c26 to 3567b24 Compare August 21, 2018 08:45
@laanwj laanwj merged commit 3567b24 into bitcoin:master Aug 21, 2018
laanwj added a commit that referenced this pull request Aug 21, 2018
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
@promag promag deleted the 2018-06-use-qt5-connect-syntax branch August 21, 2018 09:34
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Mar 23, 2020
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
wqking pushed a commit to wqking-temp/Vitae that referenced this pull request Aug 24, 2020
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
linuxsh2 pushed a commit to linuxsh2/dash that referenced this pull request Aug 17, 2021
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
linuxsh2 pushed a commit to linuxsh2/dash that referenced this pull request Aug 23, 2021
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants