From: PatR Date: Thu, 3 Feb 2022 12:17:30 +0000 (-0800) Subject: Qt: add tool tips to to extended command selector X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a722ea949bc6ea0ad132652e5e62929a026f456;p=nethack Qt: add tool tips to to extended command selector For the grid of extended commands used to pick one after typing "#", show a command's description if the mouse hovers over its button. For once something with Qt was actually easy. --- diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 4479ea456..4f218ce5f 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1408,6 +1408,8 @@ Qt: [later] augment extended command selection dialog's Filter to add a typically commands with no keystroke or only meta character keystroke; that makes Filter useful in normal mode (much shorter list of choices) Qt: add '#' as "Extended-commands" to the 'game' dropdown menu +Qt: add tool tips to the extended command selector's buttons to show command + descriptions tiles: male and female variations in monsters.txt; tested only with tile2bmp conversion utility so far; also supported by tilemap utility to generate tile.c diff --git a/win/Qt/qt_xcmd.cpp b/win/Qt/qt_xcmd.cpp index 1f61512db..8755897a6 100644 --- a/win/Qt/qt_xcmd.cpp +++ b/win/Qt/qt_xcmd.cpp @@ -294,6 +294,7 @@ NetHackQtExtCmdRequestor::NetHackQtExtCmdRequestor(QWidget *parent) : QString btn_lbl = extcmdlist[i].ef_txt; if (btn_lbl == "wait") btn_lbl += " (rest)"; + QString btn_tip = QString::asprintf(" %s ", extcmdlist[i].ef_desc); QPushButton *pb = new QPushButton(btn_lbl, grid); pb->setMinimumSize(butw, pb->sizeHint().height()); // force the button to have fixed width or it can move around a @@ -309,6 +310,8 @@ NetHackQtExtCmdRequestor::NetHackQtExtCmdRequestor(QWidget *parent) : // come as much of a surprise if (btn_lbl == "repeat") pb->setEnabled(false); + // show command description if mouse hovers over this button + pb->setToolTip(btn_tip); // extcmdlist[i].ef_desc /* * by column: xcmd_by_row==false, the default * 0..R-1 down first column, R..2*R-1 down second column, ...