]> granicus.if.org Git - nethack/commitdiff
Qt menu search
authorPatR <rankin@nethack.org>
Mon, 5 Oct 2020 23:26:27 +0000 (16:26 -0700)
committerPatR <rankin@nethack.org>
Mon, 5 Oct 2020 23:26:27 +0000 (16:26 -0700)
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.

doc/fixes37.0
win/Qt/qt_menu.cpp
win/Qt/qt_streq.cpp

index 04e64186ebe4a91188b417f1814350273b5c2089..b68978a00772ba7051c5853005d27e03c08a2892 100644 (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"
index 1da9426d733a0df170ea488ab348e93bc281f75c..d2cf8eee19b32379ecb9d46ca949619774a04042 100644 (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
index b37ab305fd1a581611960f9120c22a2145ca8415..96133edec289526c669ca9d8feb73773a5933a8b 100644 (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();