From: PatR Date: Sun, 15 Nov 2020 16:34:19 +0000 (-0800) Subject: Qt hitpointbar tweak X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0f6b3fb6eb9e1c44a338c455b0e4ea3287befb14;p=nethack Qt hitpointbar tweak 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.) --- diff --git a/win/Qt/qt_stat.cpp b/win/Qt/qt_stat.cpp index deadd798f..3ed390442 100644 --- a/win/Qt/qt_stat.cpp +++ b/win/Qt/qt_stat.cpp @@ -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;