JS8Call-Improved master
Loading...
Searching...
No Matches
PillRenderer Class Reference

Renders pill-shaped backgrounds for a QTextEdit host. More...

#include <PillRenderer.h>

Inheritance diagram for PillRenderer:
Collaboration diagram for PillRenderer:

Public Member Functions

 PillRenderer (TransmitTextEdit *host, QObject *parent=nullptr)
 Construct a PillRenderer attached to the given text edit.
void paintPills (QPaintEvent *event)
 Paint pill backgrounds behind highlighted tokens. Call before the base-class paintEvent so pills appear behind text.
bool handleTooltip (QHelpEvent *helpEvent)
 Handle a tooltip event by hit-testing pill format ranges.
void applyPillHighlighting ()
 Run the syntax highlighter and adjust letter-spacing around pills.
void setEnabled (bool enabled)
bool isEnabled () const
void setPillColors (const PillColorScheme &scheme)
void setSelectedCallsign (const QString &callsign)

Static Public Attributes

static constexpr qreal PillHPad = 8.0
 Horizontal padding.
static constexpr qreal PillVPad = 3.0
 Vertical padding.
static constexpr qreal PillMaxRadius = 11.0
 Maximum corner radius.
static constexpr qreal PillMinRadius = 7.0
 Minimum corner radius.
static constexpr qreal PillMinHPad = 5.0
 Floor during overlap resolution.
static constexpr qreal PillMinGap = 5.0
 Minimum gap between adjacent pills.

Detailed Description

Renders pill-shaped backgrounds for a QTextEdit host.

Owns a DirectedMessageHighlighter and drives it during each highlight cycle. Paints rounded-rectangle pill backgrounds behind highlighted tokens, handles tooltips on hover, and adjusts letter-spacing for proper pill padding.

Constructor & Destructor Documentation

◆ PillRenderer()

PillRenderer::PillRenderer ( TransmitTextEdit * host,
QObject * parent = nullptr )
explicit

Construct a PillRenderer attached to the given text edit.

Parameters
hostTransmitTextEdit whose document is highlighted and whose viewport receives pill painting.
parentQObject parent (typically the host itself).

Member Function Documentation

◆ handleTooltip()

bool PillRenderer::handleTooltip ( QHelpEvent * helpEvent)

Handle a tooltip event by hit-testing pill format ranges.

Returns
true if a tooltip was shown, false otherwise.

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