|
wiRedPanda
Logic Circuit Simulator
|
A small floating label drawn next to a port while a connected port is hovered. More...
#include <PortHoverLabel.h>
Public Types | |
| enum | { Type = QGraphicsItem::UserType + 4 } |
| enum class | Side { Left , Right , Top , Bottom } |
| Which side of the port the chip is biased towards, away from the element body. More... | |
Public Member Functions | |
| QRectF | boundingRect () const override |
| void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override |
| PortHoverLabel (const QString &text, Side side, QGraphicsItem *parent=nullptr) | |
| Constructs a label chip showing text, anchored at the item's origin (the port). | |
| QPainterPath | shape () const override |
| QString | text () const |
| Returns the label text (the connected port's name). | |
| int | type () const override |
A small floating label drawn next to a port while a connected port is hovered.
When the user hovers a port, ConnectionManager spawns one of these next to every port on the other end of that port's wires, so the labels of all connected endpoints are visible at once (e.g. to check that an IC pin and a 7-segment input carry matching names) without tracing each wire by hand. The chip mirrors the application tooltip styling and is removed when the hover ends.
It derives from QGraphicsObject (rather than QGraphicsItem) so ConnectionManager can track the live instances with QPointer and stay safe if the scene is cleared while a hover is active. The chip is styled to match the native QToolTip and ignores the view transform, so it reads identically to the hovered port's own tooltip at any zoom.
Definition at line 29 of file PortHoverLabel.h.
| anonymous enum |
| Enumerator | |
|---|---|
| Type | |
Definition at line 35 of file PortHoverLabel.h.
|
strong |
Which side of the port the chip is biased towards, away from the element body.
| Enumerator | |
|---|---|
| Left | |
| Right | |
| Top | |
| Bottom | |
Definition at line 33 of file PortHoverLabel.h.
|
explicit |
Constructs a label chip showing text, anchored at the item's origin (the port).
| text | The connected port's label. |
| side | Side of the origin to draw the chip on, biased away from the element body. |
| parent | Optional parent item. |
Definition at line 21 of file PortHoverLabel.cpp.
|
override |
Definition at line 56 of file PortHoverLabel.cpp.
|
override |
Definition at line 69 of file PortHoverLabel.cpp.
References ThemeManager::attributes().
|
override |
Definition at line 62 of file PortHoverLabel.cpp.
|
inline |
Returns the label text (the connected port's name).
Definition at line 47 of file PortHoverLabel.h.
Referenced by PortHoverLabel().
|
inlineoverride |
Definition at line 36 of file PortHoverLabel.h.
References Type.