Qt string requestor

Some enhancements to the widget used to get player input for
getline() and also menu search and text window search.

give caller control of [cancel] and [okay] button names;
give caller a say in how wide the string input box should be
  instead of basing that on the length of the prompt string
  (needs more work...);
use fixed-width font for displaying the user's input;
clean up the widget layout a little bit.

src/Makefile needs a dependency update for Qt (not included).
This commit is contained in:
PatR
2020-11-05 14:36:13 -08:00
parent 702e52b431
commit 24ec7f232c
3 changed files with 41 additions and 30 deletions

View File

@@ -754,7 +754,7 @@ char NetHackQtBind::qt_yn_function(const char *question_,
void NetHackQtBind::qt_getlin(const char *prompt, char *line)
{
NetHackQtStringRequestor requestor(mainWidget(),prompt);
if (!requestor.Get(line)) {
if (!requestor.Get(line, BUFSZ, 40)) {
Strcpy(line, "\033");
// discard any input that Get() might have left pending
keybuffer.Drain();