Files
nethack/win/Qt/qt_inv.h
PatR a0c6118c97 Qt paperdoll - tool tips used to describe items
New for Qt, moving the mouse over one of the slots in the paperdoll
inventory subset and letting it pause there will use Qt's tool tip
mechanism to give a description of the item under the pointer, if
there is one, or of what the slot would contain when there isn't.

So "e - uncursed leather gloves (being worn)" or "no gloves" when
the pointer is over the glove slot.  If you do something with the
keyboard to make the paperdoll change while the mouse is still
hovering, you'll need to move the pointer slightly to have Qt
recheck for tool tip at that spot.  It may be feasible to force
an immediate update, but I'm satisfied with how it's working.

Interestingly, you can move pointer and hover while yn_function()
has asked you to pick an inventory item and is waiting for an
answer.  Mostly useful for Take-off/Remove or #adjust.
2020-10-14 16:06:25 -07:00

35 lines
928 B
C++

// Copyright (c) Warwick Allison, 1999.
// Qt4 conversion copyright (c) Ray Chason, 2012-2014.
// NetHack may be freely redistributed. See license for details.
// qt_inv.h -- inventory usage window
// This is at the top center of the main window
#ifndef QT4INV_H
#define QT4INV_H
namespace nethack_qt_ {
class NetHackQtInvUsageWindow : public QWidget {
public:
NetHackQtInvUsageWindow(QWidget* parent);
virtual ~NetHackQtInvUsageWindow();
virtual void paintEvent(QPaintEvent*);
virtual QSize sizeHint(void) const;
protected:
virtual bool event(QEvent *event);
virtual void mousePressEvent(QMouseEvent *event);
private:
void drawWorn(QPainter &painter, obj *nhobj, int x, int y,
const char *alttip, bool canbe=true);
bool tooltip_event(QHelpEvent *tipevent);
char *tips[3][6]; // PAPERDOLL is a grid of 3x6 cells for tiles
};
} // namespace nethack_qt_
#endif