-
Notifications
You must be signed in to change notification settings - Fork 267
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
Rendering an amp characters in the wallet name for QMenu #828
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, 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. |
Does this hold for all supported Qt versions?
I'm not certain about that, but the mentioned comment might have been correct for some earlier version of Qt. |
Doc for qt 6 says:
Doc for qt 5 says the same:
And even doc for qt 4 says the same:
I believe that in original PR introduced a "partial fix" which works for the first ampersand no one just tested a wallet with several ampersands. I tested this fix for 2 versions: Qt 5.15.14 and Qt 5.15.11, I don't have an older one to test, but I am pretty sure that if there's no bug in the qt itself: it should works starting from 4.8 or even earlier and up to now |
It might be a platform-specific issue though. See https://bugreports.qt.io/browse/QTBUG-63361. |
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.
Tested 948520b on Ubuntu 24.04 with Qt 5.15.3. It works as expected.
Going to test other platforms.
// Menu items remove single &. Single & are shown when && is in | ||
// the string, but only the first occurrence. So replace only | ||
// the first & with &&. |
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 think that the comment should be adjusted rather than being deleted entirely.
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.
Maybe:
// Menu items remove single &. Single & are shown when && is in
// the string. So replace & with &&.
?
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 agree with @hebasto. Small nit:
// Menu items remove single &. Single & is shown when && are in
// the string. So replace & with &&.
could someone test on Mac? |
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.
ACK 948520b, modulo https://github.com/bitcoin-core/gui/pull/828/files#r1677136023.
Tested on Ubuntu 24.04, Windows 11 Pro and macOS 12.7.5 Monterey (x86).
// Menu items remove single &. Single & are shown when && is in | ||
// the string, but only the first occurrence. So replace only | ||
// the first & with &&. |
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.
Maybe:
// Menu items remove single &. Single & are shown when && is in
// the string. So replace & with &&.
?
948520b
to
7581817
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.
re-ACK 7581817
src/qt/bitcoingui.cpp
Outdated
// the string, but only the first occurrence. So replace only | ||
// the first & with &&. | ||
name.replace(name.indexOf(QChar('&')), 1, QString("&&")); | ||
// The single ampersand in the menu item's text sets a shortcut for this menu. |
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.
Maybe
// The single ampersand in the menu item's text sets a shortcut for this menu. | |
// A single ampersand in the menu item's text sets a shortcut for this item. |
?
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'll test it soon.
There's a typo in the commit body ("missleading"), since you are there, perhaps a better prefix for its title could be "gui:
" and a nit on the text could be:
The comment in the code regarding the use of an "&"
on a menu item is misleading. If a wallet name has an "&" in it,
it is not supposed to be interpreted as a hot-key, but it should be
shown as it is without replacing it to an underscore.
The comment in the code regarding the use of an "&" on a menu item is misleading. If a wallet name has an "&" in it, it is not supposed to be interpreted as a hot-key, but it should be shown as it is without replacing it to an underscore.
7581817
to
8233ee4
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.
re-ACK 8233ee4.
CI failures are unrelated.
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.
tACK 8233ee4
// Menu items remove single &. Single & are shown when && is in | ||
// the string, but only the first occurrence. So replace only | ||
// the first & with &&. |
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 agree with @hebasto. Small nit:
// Menu items remove single &. Single & is shown when && are in
// the string. So replace & with &&.
// the string, but only the first occurrence. So replace only | ||
// the first & with &&. | ||
name.replace(name.indexOf(QChar('&')), 1, QString("&&")); | ||
// An single ampersand in the menu item's text sets a shortcut for this item. |
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.
In case the above suggestion is not taken, typo here:
// An single ampersand in the menu item's text sets a shortcut for this item. | |
// A single ampersand in the menu item's text sets a shortcut for this item. |
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.
ACK 8233ee4. Tested on Ubuntu 22.04 using Qt version 5.15.3
… name for QMenu 8233ee4 gui: correct replacement of amp character in the wallet name for QMenu (Konstantin Akimov) Pull request description: In the current implementation Qt uses '&' as a signal to underscore letter and use it as a hot-key, which is not expected for case of wallet name. The [comment in the code](https://github.com/bitcoin/bitcoin/pull/30446/files#diff-2ecf8cbf369cf3d2f3d2b1cf5cfe4c1a647d63e11e2885d2fd0ac11fb5f7a804L402-L404) regarding the use of an "&" on a menu item is misleading. If a wallet name has an "&" in it, it is not supposed to be interpreted as a hot-key, but it should be shown as it is without replacing it to an underscore. See screenshots before & after: ![Screenshot_20240713_122454](https://github.com/user-attachments/assets/e36d6e4c-d872-4b4c-b55e-bcfde9881281) ![Screenshot_20240713_131304](https://github.com/user-attachments/assets/9484687d-0aea-4061-a461-5d187762a4b4) ACKs for top commit: hebasto: re-ACK 8233ee4. pablomartin4btc: tACK 8233ee4 BrandonOdiwuor: ACK 8233ee4. Tested on Ubuntu 22.04 using Qt version 5.15.3 Tree-SHA512: 918c2c05555d203a8b203794c138651d4a1691a05a858631d5a4664b78e150402d1ae4a02ee5181f63a5b22a09badca0a4ea14a626f45f8cbe557226c308b8c5
… name for QMenu 8233ee4 gui: correct replacement of amp character in the wallet name for QMenu (Konstantin Akimov) Pull request description: In the current implementation Qt uses '&' as a signal to underscore letter and use it as a hot-key, which is not expected for case of wallet name. The [comment in the code](https://github.com/bitcoin/bitcoin/pull/30446/files#diff-2ecf8cbf369cf3d2f3d2b1cf5cfe4c1a647d63e11e2885d2fd0ac11fb5f7a804L402-L404) regarding the use of an "&" on a menu item is misleading. If a wallet name has an "&" in it, it is not supposed to be interpreted as a hot-key, but it should be shown as it is without replacing it to an underscore. See screenshots before & after: ![Screenshot_20240713_122454](https://github.com/user-attachments/assets/e36d6e4c-d872-4b4c-b55e-bcfde9881281) ![Screenshot_20240713_131304](https://github.com/user-attachments/assets/9484687d-0aea-4061-a461-5d187762a4b4) ACKs for top commit: hebasto: re-ACK 8233ee4. pablomartin4btc: tACK 8233ee4 BrandonOdiwuor: ACK 8233ee4. Tested on Ubuntu 22.04 using Qt version 5.15.3 Tree-SHA512: 918c2c05555d203a8b203794c138651d4a1691a05a858631d5a4664b78e150402d1ae4a02ee5181f63a5b22a09badca0a4ea14a626f45f8cbe557226c308b8c5
… name for QMenu 8233ee4 gui: correct replacement of amp character in the wallet name for QMenu (Konstantin Akimov) Pull request description: In the current implementation Qt uses '&' as a signal to underscore letter and use it as a hot-key, which is not expected for case of wallet name. The [comment in the code](https://github.com/bitcoin/bitcoin/pull/30446/files#diff-2ecf8cbf369cf3d2f3d2b1cf5cfe4c1a647d63e11e2885d2fd0ac11fb5f7a804L402-L404) regarding the use of an "&" on a menu item is misleading. If a wallet name has an "&" in it, it is not supposed to be interpreted as a hot-key, but it should be shown as it is without replacing it to an underscore. See screenshots before & after: ![Screenshot_20240713_122454](https://github.com/user-attachments/assets/e36d6e4c-d872-4b4c-b55e-bcfde9881281) ![Screenshot_20240713_131304](https://github.com/user-attachments/assets/9484687d-0aea-4061-a461-5d187762a4b4) ACKs for top commit: hebasto: re-ACK 8233ee4. pablomartin4btc: tACK 8233ee4 BrandonOdiwuor: ACK 8233ee4. Tested on Ubuntu 22.04 using Qt version 5.15.3 Tree-SHA512: 918c2c05555d203a8b203794c138651d4a1691a05a858631d5a4664b78e150402d1ae4a02ee5181f63a5b22a09badca0a4ea14a626f45f8cbe557226c308b8c5
…, #362, #828, bitcoin#21912, bitcoin#21942, bitcoin#21988 c7d3161 Merge bitcoin-core/gui#362: Add keyboard shortcuts to context menus (Hennadii Stepanov) 25f87b9 Merge bitcoin-core/gui#121: Early subscribe core signals in transaction table model (Hennadii Stepanov) ed56e28 Merge bitcoin-core/gui#335: test: Use QSignalSpy instead of QEventLoop (Hennadii Stepanov) c52b756 Merge bitcoin-core/gui#281: set shortcuts for console's resize buttons (W. J. van der Laan) b442a59 Merge bitcoin#21988: doc: note that brew installed qt is not supported (W. J. van der Laan) 0e2e315 Merge bitcoin#21942: docs: improve make with parallel jobs description. (MarcoFalke) c2735a8 Merge bitcoin#21912: doc: Remove mention of priority estimation (W. J. van der Laan) 1d56d20 Merge bitcoin-core/gui#257: refactor: Use template function qOverload in signal-slot connections (Hennadii Stepanov) b5fb559 Merge bitcoin-core/gui#18: Add peertablesortproxy module (Hennadii Stepanov) 1cdd9fb refactor: use new QAction style for governance list and masternode list (Konstantin Akimov) 4f89c98 Merge bitcoin-core/gui#263: Revamp context menus (Hennadii Stepanov) c36bb8e fix: use && in governance urls instead & (Konstantin Akimov) 1e585b1 Merge bitcoin-core/gui#828: Rendering an amp characters in the wallet name for QMenu (Hennadii Stepanov) Pull request description: ## Issue being fixed or feature implemented Just regular backports from bitcoin v22, mostly Qt related ## What was done? See commits for a list of backports. This PR also fixes a rendering an url on Governance tab if it has any '&' inside. see screenshots. Original url: `https://example.com/?test=nothing&to=see&&lol` - yes, double '&&' just for test even if url is silly. Failed behaviour: ![image](https://github.com/user-attachments/assets/ac45c192-7d0e-4cd2-97f8-060af8f3911b) Correctly rendered: ![image](https://github.com/user-attachments/assets/5e345197-776a-4bb8-9476-cab4aba3429e) ## How Has This Been Tested? Run unit/functional tests ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: PastaPastaPasta: utACK c7d3161 UdjinM6: utACK c7d3161 Tree-SHA512: 67e7e8e0ec1a768d1f13baa48c123e4a415d3f32177a427d8117339a5eacf70864ebf46e9f1165bb8a3bf9c231f7929d33ac6aa19742e06a4e19d2f86dda6dc3
In the current implementation Qt uses '&' as a signal to underscore letter and use it as a hot-key, which is not expected for case of wallet name.
The comment in the code regarding the use of an "&" on a menu item is misleading.
If a wallet name has an "&" in it, it is not supposed to be interpreted as a hot-key, but it should be shown as it is without replacing it to an underscore.
See screenshots before & after: