Skip to content

Commit 8233ee4

Browse files
committed
gui: correct replacement of amp character in the wallet name for QMenu
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.
1 parent c4d45b6 commit 8233ee4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/qt/bitcoingui.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,9 @@ void BitcoinGUI::createActions()
399399
for (const std::pair<const std::string, bool>& i : m_wallet_controller->listWalletDir()) {
400400
const std::string& path = i.first;
401401
QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path);
402-
// Menu items remove single &. Single & are shown when && is in
403-
// the string, but only the first occurrence. So replace only
404-
// the first & with &&.
405-
name.replace(name.indexOf(QChar('&')), 1, QString("&&"));
402+
// An single ampersand in the menu item's text sets a shortcut for this item.
403+
// Single & are shown when && is in the string. So replace & with &&.
404+
name.replace(QChar('&'), QString("&&"));
406405
QAction* action = m_open_wallet_menu->addAction(name);
407406

408407
if (i.second) {

0 commit comments

Comments
 (0)