Qt status again: unhighlight disabled fields
If 'showscore' has been On and gets toggled Off while Score is highlighted, remove that highlight immediately instead of letting it stick around a few turns until it times out.
This commit is contained in:
@@ -63,8 +63,8 @@ NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget *parent, const char *l,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set up the style sheet strings used to specify color for status field
|
// set up the style sheet strings used to specify color for status field
|
||||||
// labels [done "once", but once for each LabelledIcon that's constucted,
|
// labels [done "once", but once for each LabelledIcon that's constructed,
|
||||||
// so more than 20 copies overall]
|
// so about 30 copies overall with 3.6's status conditions]
|
||||||
void NetHackQtLabelledIcon::initHighlight()
|
void NetHackQtLabelledIcon::initHighlight()
|
||||||
{
|
{
|
||||||
// note: string "green" is much darker than enum Qt::green
|
// note: string "green" is much darker than enum Qt::green
|
||||||
@@ -90,6 +90,11 @@ void NetHackQtLabelledIcon::setLabel(const QString &t, bool lower)
|
|||||||
: (comp_mode == (lower ? SmallerIsBetter
|
: (comp_mode == (lower ? SmallerIsBetter
|
||||||
: BiggerIsBetter)) ? hl_better
|
: BiggerIsBetter)) ? hl_better
|
||||||
: hl_worse);
|
: hl_worse);
|
||||||
|
} else if (turn_count) {
|
||||||
|
// if we don't want to highlight this status field but it is
|
||||||
|
// currently highlighted (perhaps optional Score recently went
|
||||||
|
// up and has just been toggled off), remove the highlight
|
||||||
|
unhighlight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,9 +76,6 @@
|
|||||||
// The field passed to xp.setLabel() for its better vs worse comparison
|
// The field passed to xp.setLabel() for its better vs worse comparison
|
||||||
// gets swapped from Xp to Exp or vice versa, yielding a nonsensical
|
// gets swapped from Xp to Exp or vice versa, yielding a nonsensical
|
||||||
// comparison for the first status update after the 'showexp' toggle.
|
// comparison for the first status update after the 'showexp' toggle.
|
||||||
// Toggling 'showscore' while Score is highlighted leaves the highlight
|
|
||||||
// on blank space until it times out. (Time isn't highlighted and Exp
|
|
||||||
// is combined with Xp so always updated; only Score is affected.)
|
|
||||||
//
|
//
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -694,9 +691,10 @@ void NetHackQtStatusWindow::updateStats()
|
|||||||
QString buf;
|
QString buf;
|
||||||
|
|
||||||
if (first_set) {
|
if (first_set) {
|
||||||
|
// set toggle-detection flags for optional fields
|
||||||
was_polyd = Upolyd ? true : false;
|
was_polyd = Upolyd ? true : false;
|
||||||
had_exp = ::flags.showexp ? true : false;
|
had_exp = ::flags.showexp ? true : false;
|
||||||
// not '#ifndef SCORE_ON_BOTL' here; use the variable and the widget
|
// not conditionalized upon '#ifdef SCORE_ON_BOTL' here
|
||||||
had_score = ::flags.showscore ? true : false; // false when disabled
|
had_score = ::flags.showscore ? true : false; // false when disabled
|
||||||
score.setLabel(""); // init if enabled, one-time set if disabled
|
score.setLabel(""); // init if enabled, one-time set if disabled
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user