]> granicus.if.org Git - nethack/commitdiff
Qt hitpointbar tweak
authorPatR <rankin@nethack.org>
Sun, 15 Nov 2020 16:34:19 +0000 (08:34 -0800)
committerPatR <rankin@nethack.org>
Sun, 15 Nov 2020 16:34:19 +0000 (08:34 -0800)
When the hitpointbar is showing thick blue + thin dark blue (75%
or better health but less than 100%) and partial healing occurs,
the dark blue portion was momentarily visible pushed off the
right edge of the bar, resulting in slight flicker as the right
half of the bar got redrawn.  I haven't noticed anything similar
for the paler injured-side colors, nor any temporary gap between
the two sides when losing health.

Also, remove a workaround that was needed at one point but isn't
needed anymore.  (I don't remember the circumstances.)

win/Qt/qt_stat.cpp

index deadd798f42cf9196cca8e17b9b9b1e499f2bc7f..3ed390442c157da78cd587f61af79ae88cb72ed0 100644 (file)
@@ -521,8 +521,10 @@ void NetHackQtStatusWindow::HitpointBar()
             w = geoH.right() - geoH.left() + 1; // might yield 0 (ie, if dead)
             styleH.sprintf(styleformat, barcolors[colorindx][0], w, w);
             hpbar_health.setStyleSheet(styleH);
-            // style sheet should be doing this but width was sticking at full
-            hpbar_health.setMaximumWidth(w);
+            // when healing, having the old injury-side shown while the new
+            // health-side expands pushes the injury farther right and it's
+            // momentarily visible there before it gets recalculated+redrawn
+            hpbar_injury.hide(); // will re-show below
             hpbar_health.show(); // don't need to hide() if/when width is 0
 
             int oldleft = geoI.left();
@@ -550,7 +552,6 @@ void NetHackQtStatusWindow::HitpointBar()
             w = geoH.right() - geoH.left() + 1;
             styleH.sprintf(styleformat, barcolors[colorindx][0], w, w);
             hpbar_health.setStyleSheet(styleH);
-            hpbar_health.setMaximumWidth(w); // (see above)
             hpbar_health.show();
 
             alreadyfullhp = true;