QLegendMarker Class

The QLegendMarker class is an abstract object that can be used to access markers within a legend. More...

Public Types

enum LegendMarkerType { LegendMarkerTypeArea, LegendMarkerTypeBar, LegendMarkerTypePie, LegendMarkerTypeXY, LegendMarkerTypeBoxPlot, LegendMarkerTypeCandlestick }

Properties

Public Functions

QBrush brush() const
QFont font() const
bool isVisible() const
QString label() const
QBrush labelBrush() const
QPen pen() const
void setBrush(const QBrush &brush)
void setFont(const QFont &font)
void setLabel(const QString &label)
void setLabelBrush(const QBrush &brush)
void setPen(const QPen &pen)
void setShape(QLegend::MarkerShape shape)
void setVisible(bool visible)
QLegend::MarkerShape shape() const

Signals

Detailed Description

A legend marker consists of an icon and a label. The icon color corresponds to the color used to draw a series and the label displays the name of the series (or the label of the slice for a pie series or bar set for a bar series). A legend marker is always related to one series, slice, or bar set.

See also QLegend.

Member Type Documentation

enum QLegendMarker::LegendMarkerType

The type of the legend marker object.

ConstantValueDescription
QLegendMarker::LegendMarkerTypeArea0A legend marker for an area series.
QLegendMarker::LegendMarkerTypeBar1A legend marker for a bar set.
QLegendMarker::LegendMarkerTypePie2A legend marker for a pie slice.
QLegendMarker::LegendMarkerTypeXY3A legend marker for a line, spline, or scatter series.
QLegendMarker::LegendMarkerTypeBoxPlot4A legend marker for a box plot series.
QLegendMarker::LegendMarkerTypeCandlestick5A legend marker for a candlestick series.

This enum was introduced or modified in Qt 5.8.

Property Documentation

brush : QBrush

This property holds the brush used to fill the icon.

Access functions:

QBrush brush() const
void setBrush(const QBrush &brush)

Notifier signal:

void brushChanged()

font : QFont

This property holds the font of the label.

Access functions:

QFont font() const
void setFont(const QFont &font)

Notifier signal:

void fontChanged()

label : QString

This property holds the text shown in the legend for a legend marker.

Access functions:

QString label() const
void setLabel(const QString &label)

Notifier signal:

void labelChanged()

labelBrush : QBrush

This property holds the brush of the label.

Access functions:

QBrush labelBrush() const
void setLabelBrush(const QBrush &brush)

Notifier signal:

void labelBrushChanged()

pen : QPen

This property holds the pen used to draw the outline of the icon.

Access functions:

QPen pen() const
void setPen(const QPen &pen)

Notifier signal:

void penChanged()

shape : QtCharts::QLegend::MarkerShape

The shape of the legend marker. Defaults to QLegend::MarkerShapeDefault, which indicates the shape is determined by QLegend::markerShape property.

Access functions:

QLegend::MarkerShape shape() const
void setShape(QLegend::MarkerShape shape)

Notifier signal:

void shapeChanged()

visible : bool

This property holds the visibility of the legend marker.

The visibility affects both the legend marker label and the icon.

Access functions:

bool isVisible() const
void setVisible(bool visible)

Notifier signal:

void visibleChanged()