Qt: add tool tips for status window icons

Show a tip if the mouse hovers over any of the various icons displayed
in the status window (for one each of the six characteristics, another
for alignment, and one for each status condition).  They all already
have text labels below but many of those are abbreviated; the tips can
be more verbose since they don't compete with each for for screen space.

Also fixes "weak" not being centered under the hunger icon.  It /was/
centered but invisible trailing spaces made the visible text be shifted
to the left.
This commit is contained in:
PatR
2022-02-05 18:43:44 -08:00
parent 8aa29f8a08
commit 44398d90b7
4 changed files with 52 additions and 35 deletions

View File

@@ -118,11 +118,15 @@ void NetHackQtLabelledIcon::setLabel(const QString& t, long v,
setLabel(t,v,v,tail);
}
void NetHackQtLabelledIcon::setIcon(const QPixmap& i)
void NetHackQtLabelledIcon::setIcon(
const QPixmap& i,
const QString& tooltip)
{
if (!icon)
icon = new QLabel(this);
icon->setPixmap(i);
if (!tooltip.isNull() && !tooltip.isEmpty())
icon->setToolTip(" " + tooltip + " ");
ForceResize();
icon->resize(i.width(), i.height());
}