Qt popup dialog input vs '&'

I'm not sure whether any yn_function() calls include ampersand
in the list of acceptable choices but if any did, the button
for that character would have shown up blank.  (Clicking on it
would have successfully produced '&' as player's input though.)
This commit is contained in:
PatR
2020-10-26 12:44:40 -07:00
parent ec5772d6d2
commit 9c384ba867
2 changed files with 13 additions and 1 deletions
+2 -1
View File
@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.341 $ $NHDT-Date: 1603666043 2020/10/25 22:47:23 $ NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.342 $ $NHDT-Date: 1603741470 2020/10/26 19:44:30 $
General Fixes and Modified Features General Fixes and Modified Features
----------------------------------- -----------------------------------
@@ -458,6 +458,7 @@ Qt: rename toolbar button "Get" and action menu choice "Get" to "Pick up"
Qt: status icons for alignment|hunger|encumbrance which started out centered Qt: status icons for alignment|hunger|encumbrance which started out centered
relative to the label text below them would shift to being left relative to the label text below them would shift to being left
justified when status got updated justified when status got updated
Qt: handle '&' properly if it occurs as part of yn_function popup dialog
Qt+OSX: fix control key Qt+OSX: fix control key
Qt+OSX: rename menu entry "nethack->Preferences..." for invoking nethack's Qt+OSX: rename menu entry "nethack->Preferences..." for invoking nethack's
'O' command to "Game->Run-time options" and entry "Game->Qt settings" 'O' command to "Game->Run-time options" and entry "Game->Qt settings"
+11
View File
@@ -246,6 +246,17 @@ char NetHackQtYnDialog::Exec()
case '\033': // won't happen; ESC is hidden case '\033': // won't happen; ESC is hidden
button_name = "Esc"; button_name = "Esc";
break; break;
case '&':
// ampersand is used as a hidden quote char to flag
// next character as a keyboard shortcut associated
// with the current action--that's inappropriate here;
// two consecutive ampersands are needed to display
// one in a button label; first check whether caller
// has already done that, skip this one if so
if (i > 0 && ch[i - 1].cell() == QChar('&'))
continue; // next i
button_name = "&&";
break;
} }
} }
button=new QPushButton(button_name); button=new QPushButton(button_name);