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

Item delegate that renders a spark-line (miniature inline chart) for cells whose model data contains a series of numeric values. More...

#include <sparkline_delegate.h>

Inheritance diagram for SparkLineDelegate:

Public Member Functions

 SparkLineDelegate (QWidget *parent=0)
 Constructs a SparkLineDelegate.

Static Public Attributes

static constexpr int SecondaryPointsRole = Qt::UserRole + 1
 Optional second value series, drawn over the primary one.
static constexpr int GapValue = -1
 A negative value in either series marks a gap (a line break with a dashed bridge), used to show an interval where no data was sampled.

Protected Member Functions

void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Renders the spark-line chart for the cell at index.
QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Returns the preferred size for a spark-line cell.
QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Suppresses inline editing by returning nullptr.

Detailed Description

Item delegate that renders a spark-line (miniature inline chart) for cells whose model data contains a series of numeric values.

Constructor & Destructor Documentation

◆ SparkLineDelegate()

SparkLineDelegate::SparkLineDelegate ( QWidget * parent = 0)
inline

Constructs a SparkLineDelegate.

Parameters
parentOptional parent widget.

Member Function Documentation

◆ createEditor()

QWidget * SparkLineDelegate::createEditor ( QWidget * parent,
const QStyleOptionViewItem & option,
const QModelIndex & index ) const
overrideprotected

Suppresses inline editing by returning nullptr.

Spark-line cells are display-only; no editor widget is created.

Parameters
parentUnused parent widget.
optionUnused style option.
indexUnused model index.
Returns
Always nullptr.

◆ paint()

void SparkLineDelegate::paint ( QPainter * painter,
const QStyleOptionViewItem & option,
const QModelIndex & index ) const
overrideprotected

Renders the spark-line chart for the cell at index.

Parameters
painterPainter to draw with.
optionStyle option providing geometry, palette, and state.
indexModel index of the cell being painted.

◆ sizeHint()

QSize SparkLineDelegate::sizeHint ( const QStyleOptionViewItem & option,
const QModelIndex & index ) const
overrideprotected

Returns the preferred size for a spark-line cell.

Parameters
optionStyle option providing font metrics and state.
indexModel index of the cell being measured.
Returns
Recommended QSize for the cell.

Member Data Documentation

◆ SecondaryPointsRole

int SparkLineDelegate::SecondaryPointsRole = Qt::UserRole + 1
staticconstexpr

Optional second value series, drawn over the primary one.

The primary series is read from Qt::UserRole (unchanged). A model may additionally provide a second QList<int> at this role (e.g. dropped packets); when present it is drawn on the same scale in a distinct theme color. Models that don't provide it render exactly one line as before.


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