Qt status panel as command button
Clicking on the status panel runs ^X to show character and status information without abbreviations. The code needed is identical to what's now used for clicking on the paper doll inventory panel except for the command to execute.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.322 $ $NHDT-Date: 1602002574 2020/10/06 16:42:54 $
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.323 $ $NHDT-Date: 1602022805 2020/10/06 22:20:05 $
|
||||
|
||||
General Fixes and Modified Features
|
||||
-----------------------------------
|
||||
@@ -569,6 +569,7 @@ Qt: draw a border around each tile in the paper doll inventory; when BUC is
|
||||
Qt: clicking on the paper doll runs the #seeall command (inventory of wielded
|
||||
and worn items plus tools [lamps, leashes] actively in use; in other
|
||||
words, same set of things whose tiles are used to populate the doll)
|
||||
Qt: clicking on the status window runs the #attributes command (^X)
|
||||
|
||||
|
||||
NetHack Community Patches (or Variation) Included
|
||||
|
||||
@@ -396,13 +396,13 @@ void NetHackQtStatusWindow::fadeHighlighting()
|
||||
* the other. So only do our update when we update the second line.
|
||||
*
|
||||
* Information on the first line:
|
||||
* name, attributes, alignment, score
|
||||
* name, Str/Dex/&c characteristics, alignment, score
|
||||
*
|
||||
* Information on the second line:
|
||||
* dlvl, gold, hp, power, ac, {level & exp or HD **}
|
||||
* status (hunger, encumbrance, sick, stun, conf, halu, blind), time
|
||||
*
|
||||
* [**] HD is shown instead of level and exp if mtimedone is non-zero.
|
||||
* [**] HD is shown instead of level and exp when hero is polymorphed.
|
||||
*/
|
||||
void NetHackQtStatusWindow::updateStats()
|
||||
{
|
||||
@@ -553,8 +553,7 @@ void NetHackQtStatusWindow::updateStats()
|
||||
score.setLabel("");
|
||||
}
|
||||
|
||||
if (first_set)
|
||||
{
|
||||
if (first_set) {
|
||||
first_set=false;
|
||||
|
||||
name.highlightWhenChanging();
|
||||
@@ -604,4 +603,18 @@ void NetHackQtStatusWindow::checkTurnEvents()
|
||||
{
|
||||
}
|
||||
|
||||
// clicking on status window runs #attributes (^X)
|
||||
void NetHackQtStatusWindow::mousePressEvent(QMouseEvent *event UNUSED)
|
||||
{
|
||||
// same code as NetHackQtInvUsageWindow::mousePressEvent except for func
|
||||
char cmdbuf[32];
|
||||
Strcpy(cmdbuf, "#");
|
||||
(void) cmdname_from_func(doattributes, &cmdbuf[1], FALSE);
|
||||
// queue up #attribues as if user had typed it; we don't execute
|
||||
// doattributes() directly because the program might not be ready
|
||||
// for a command right now
|
||||
QWidget *main = NetHackQtBind::mainWidget();
|
||||
(static_cast <NetHackQtMainWindow *> (main))->DollClickToKeys(cmdbuf);
|
||||
}
|
||||
|
||||
} // namespace nethack_qt_
|
||||
|
||||
@@ -27,6 +27,7 @@ public:
|
||||
void fadeHighlighting();
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent *event);
|
||||
//RLC void resizeEvent(QResizeEvent*);
|
||||
|
||||
private slots:
|
||||
|
||||
Reference in New Issue
Block a user