diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2024-07-29 10:30:55 +0100 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2024-07-29 10:33:32 +0100 |
commit | c9b7a792e2d8cfe5be14829ee6108d24abf8fcf6 (patch) | |
tree | c5294f866e9f3565b5d6df77e8469b105c46feb3 /src/qt | |
parent | ec7ba7a3cfd298e75f6f4b4f76ce96410082454e (diff) | |
parent | 8233ee41ab9648cd0c3bd78bc2a8d692a54d9ea0 (diff) |
Merge bitcoin-core/gui#828: Rendering an amp characters in the wallet name for QMenu
8233ee41ab9648cd0c3bd78bc2a8d692a54d9ea0 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 8233ee41ab9648cd0c3bd78bc2a8d692a54d9ea0.
pablomartin4btc:
tACK 8233ee41ab9648cd0c3bd78bc2a8d692a54d9ea0
BrandonOdiwuor:
ACK 8233ee41ab9648cd0c3bd78bc2a8d692a54d9ea0. Tested on Ubuntu 22.04 using Qt version 5.15.3
Tree-SHA512: 918c2c05555d203a8b203794c138651d4a1691a05a858631d5a4664b78e150402d1ae4a02ee5181f63a5b22a09badca0a4ea14a626f45f8cbe557226c308b8c5
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/bitcoingui.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index a43009d954..1f78550a55 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -399,10 +399,9 @@ void BitcoinGUI::createActions() for (const std::pair<const std::string, bool>& i : m_wallet_controller->listWalletDir()) { const std::string& path = i.first; QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path); - // Menu items remove single &. Single & are shown when && is in - // 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. + // Single & are shown when && is in the string. So replace & with &&. + name.replace(QChar('&'), QString("&&")); QAction* action = m_open_wallet_menu->addAction(name); if (i.second) { |