Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
LabelStack Class Reference

A QLabel that manages a stack of context-tagged text messages. More...

#include <label_stack.h>

Inheritance diagram for LabelStack:

Public Slots

void popText (int ctx)
 Remove the stack entry associated with ctx.

Signals

void toggleTemporaryFlash (bool enable)
 Emitted when the temporary flash state changes.
void mousePressedAt (const QPoint &global_pos, Qt::MouseButton button)
 Emitted when a mouse button is pressed on the label.

Public Member Functions

 LabelStack (QWidget *parent=0)
 Construct a LabelStack.
void setTemporaryContext (const int ctx)
 Designate a context ID as the "temporary" context.
void pushText (const QString &text, int ctx, const QString &tooltip=QString())
 Push a text message onto the label stack.
void setShrinkable (bool shrinkable=true)
 Control whether the label may shrink below its preferred width.

Protected Member Functions

void mousePressEvent (QMouseEvent *event) override
 Forward mouse press position and button via mousePressedAt().
void mouseReleaseEvent (QMouseEvent *event) override
 Handle mouse button release (reserved for subclass use).
void mouseDoubleClickEvent (QMouseEvent *event) override
 Handle double-click events (reserved for subclass use).
void mouseMoveEvent (QMouseEvent *event) override
 Handle mouse move events (reserved for subclass use).
void contextMenuEvent (QContextMenuEvent *event) override
 Show a context menu for the label (reserved for subclass use).
void paintEvent (QPaintEvent *event) override
 Paint the label, applying elision if shrinkable and space is tight.

Detailed Description

A QLabel that manages a stack of context-tagged text messages.

Constructor & Destructor Documentation

◆ LabelStack()

LabelStack::LabelStack ( QWidget * parent = 0)
explicit

Construct a LabelStack.

Parameters
parentThe parent widget.

Member Function Documentation

◆ contextMenuEvent()

void LabelStack::contextMenuEvent ( QContextMenuEvent * event)
overrideprotected

Show a context menu for the label (reserved for subclass use).

Parameters
eventThe context menu event.

◆ mouseDoubleClickEvent()

void LabelStack::mouseDoubleClickEvent ( QMouseEvent * event)
overrideprotected

Handle double-click events (reserved for subclass use).

Parameters
eventThe double-click event.

◆ mouseMoveEvent()

void LabelStack::mouseMoveEvent ( QMouseEvent * event)
overrideprotected

Handle mouse move events (reserved for subclass use).

Parameters
eventThe mouse move event.

◆ mousePressedAt

void LabelStack::mousePressedAt ( const QPoint & global_pos,
Qt::MouseButton button )
signal

Emitted when a mouse button is pressed on the label.

Parameters
global_posThe cursor position in global screen coordinates.
buttonThe mouse button that was pressed.

◆ mousePressEvent()

void LabelStack::mousePressEvent ( QMouseEvent * event)
overrideprotected

Forward mouse press position and button via mousePressedAt().

Parameters
eventThe mouse press event.

◆ mouseReleaseEvent()

void LabelStack::mouseReleaseEvent ( QMouseEvent * event)
overrideprotected

Handle mouse button release (reserved for subclass use).

Parameters
eventThe mouse release event.

◆ paintEvent()

void LabelStack::paintEvent ( QPaintEvent * event)
overrideprotected

Paint the label, applying elision if shrinkable and space is tight.

Parameters
eventThe paint event.

◆ popText

void LabelStack::popText ( int ctx)
slot

Remove the stack entry associated with ctx.

Parameters
ctxThe context ID whose entry should be removed.

◆ pushText()

void LabelStack::pushText ( const QString & text,
int ctx,
const QString & tooltip = QString() )

Push a text message onto the label stack.

Parameters
textThe message text to display.
ctxThe context ID that owns this message; used to pop it later.
tooltipOptional tooltip string shown on hover; defaults to empty.

◆ setShrinkable()

void LabelStack::setShrinkable ( bool shrinkable = true)

Control whether the label may shrink below its preferred width.

Parameters
shrinkabletrue to allow shrinking (default); false to enforce the full preferred width.

◆ setTemporaryContext()

void LabelStack::setTemporaryContext ( const int ctx)

Designate a context ID as the "temporary" context.

Parameters
ctxThe context ID to treat as temporary.

◆ toggleTemporaryFlash

void LabelStack::toggleTemporaryFlash ( bool enable)
signal

Emitted when the temporary flash state changes.

Parameters
enabletrue when a temporary message is active and flashing; false when it has expired and the label has reverted.

The documentation for this class was generated from the following files: