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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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, ...
|
||||
|
||||
Reference in New Issue
Block a user