]> granicus.if.org Git - nethack/commitdiff
Qt status panel as command button
authorPatR <rankin@nethack.org>
Tue, 6 Oct 2020 22:20:25 +0000 (15:20 -0700)
committerPatR <rankin@nethack.org>
Tue, 6 Oct 2020 22:20:25 +0000 (15:20 -0700)
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.

doc/fixes37.0
win/Qt/qt_stat.cpp
win/Qt/qt_stat.h

index 378797cfe171eb42669c436bac37c9545309ecf0..0246efc538eb6a8d3b0957ca618719ac1caf9e28 100644 (file)
@@ -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
index 7ba03c54981630cf493f3ff9e1fd28f89f381917..7da64cfc67f8045ddc6b01906c29cdd0581831b7 100644 (file)
@@ -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_
index 2b738228903cfe86fcf1a96fcb57f64835d2d314..a8d27cb952ca310bef182e75e644f07ab766359d 100644 (file)
@@ -27,6 +27,7 @@ public:
        void fadeHighlighting();
 
 protected:
+       virtual void mousePressEvent(QMouseEvent *event);
        //RLC void resizeEvent(QResizeEvent*);
 
 private slots: