Qt menu search

Remove a 'TODO' for once.  Have the popup that's used to accept the
target string--after clicking on [search] or typing ':' to initiate
menu search+select operation--force keyboard focus to itself.  Menu
searching worked without this, but only if you manually clicked on
the search popup prior to typing the target string.  Failure to do
so resulted in typed characters being used to select menu entries.
This commit is contained in:
PatR
2020-10-05 16:26:27 -07:00
parent 37339abebd
commit d7a52cf0c4
3 changed files with 11 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.318 $ $NHDT-Date: 1601600393 2020/10/02 00:59:53 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.321 $ $NHDT-Date: 1601940384 2020/10/05 23:26:24 $
General Fixes and Modified Features
-----------------------------------
@@ -430,6 +430,9 @@ Qt: 3.6 catchup - show unexplored locations as unexplored rather than as stone
Qt: tried to honor 'showexp' but the value was unintentionally suppressed by
[lack of definition for] obsolete conditional EXP_ON_BOTL
Qt: implement --More-- prompt to support MSGTYPE=stop
Qt: for menu search, don't require clicking on the search target popup before
typing target string (was using typed letters to make menu selections
if player didn't click on the popup first)
Qt+QSX: fix control key
Qt+OSX: rename menu entry "nethack->Preferences..." for invoking nethack's
'O' command to "Game->Run-time options" and entry "Game->Qt settings"

View File

@@ -6,8 +6,6 @@
//
// TODO:
// search behaves weirdly unless you click in the line-edit dialog box
// after clicking on the [search] button to pop that up;
// implement next_page, prev_page, first_page, and last_page to work
// like they do for X11: scroll menu window as if it were paginated;
// entering a count that uses more digits than the previous biggest count

View File

@@ -83,6 +83,13 @@ bool NetHackQtStringRequestor::Get(char* buffer, int maxchar)
#endif
centerOnMain(this);
show();
// Make sure that setFocus() really does change keyboard focus.
// This allows typing to go directly to the NetHackQtLineEdit
// widget without clicking on or in it first. Not needed for
// qt_getline() but is needed for menu Search to prevent typed
// characters being treated as making menu selections.
if (!input.isActiveWindow())
input.activateWindow();
input.setFocus();
exec();