QLegendMarker Class
The QLegendMarker class is an abstract object that can be used to access markers within a legend. More...
| Header: | #include <QLegendMarker> |
| Inherits: | QObject |
| Inherited By: | QAreaLegendMarker, QBarLegendMarker, QBoxPlotLegendMarker, QCandlestickLegendMarker, QPieLegendMarker, and QXYLegendMarker |
Public Types
| enum | LegendMarkerType { LegendMarkerTypeArea, LegendMarkerTypeBar, LegendMarkerTypePie, LegendMarkerTypeXY, LegendMarkerTypeBoxPlot, LegendMarkerTypeCandlestick } |
Properties
|
- 1 property inherited from QObject
Public Functions
| virtual | ~QLegendMarker() |
| QBrush | brush() const |
| QFont | font() const |
| bool | isVisible() const |
| QString | label() const |
| QBrush | labelBrush() const |
| QPen | pen() const |
| virtual QAbstractSeries * | series() = 0 |
| 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 |
| virtual QLegendMarker::LegendMarkerType | type() = 0 |
- 31 public functions inherited from QObject
Signals
| void | brushChanged() |
| void | clicked() |
| void | fontChanged() |
| void | hovered(bool status) |
| void | labelBrushChanged() |
| void | labelChanged() |
| void | penChanged() |
| void | shapeChanged() |
| void | visibleChanged() |
- 2 signals inherited from QObject
Static Public Members
| const QMetaObject | staticMetaObject |
- 9 static public members inherited from QObject
Protected Variables
| QScopedPointer<QLegendMarkerPrivate> | d_ptr |
Additional Inherited Members
Detailed Description
The QLegendMarker class is an abstract object that can be used to access markers within a legend.
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.
| Constant | Value | Description |
|---|---|---|
QLegendMarker::LegendMarkerTypeArea | 0 | A legend marker for an area series. |
QLegendMarker::LegendMarkerTypeBar | 1 | A legend marker for a bar set. |
QLegendMarker::LegendMarkerTypePie | 2 | A legend marker for a pie slice. |
QLegendMarker::LegendMarkerTypeXY | 3 | A legend marker for a line, spline, or scatter series. |
QLegendMarker::LegendMarkerTypeBoxPlot | 4 | A legend marker for a box plot series. |
QLegendMarker::LegendMarkerTypeCandlestick | 5 | A 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:
Notifier signal:
| void | brushChanged() |
font : QFont
This property holds the font of the label.
Access functions:
Notifier signal:
| void | fontChanged() |
label : QString
This property holds the text shown in the legend for a legend marker.
Access functions:
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:
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() |
Member Function Documentation
[virtual] QLegendMarker::~QLegendMarker()
Removes the legend marker.
QBrush QLegendMarker::brush() const
Returns the brush used to fill the icon.
Note: Getter function for property brush.
See also setBrush().
[signal] void QLegendMarker::clicked()
QFont QLegendMarker::font() const
Retuns the font of the label.
Note: Getter function for property font.
See also setFont().
[signal] void QLegendMarker::hovered(bool status)
bool QLegendMarker::isVisible() const
Returns the visibility of the marker.
Note: Getter function for property visible.
QString QLegendMarker::label() const
Returns the label of the marker.
Note: Getter function for property label.
See also setLabel().
QBrush QLegendMarker::labelBrush() const
Returns the brush that is used to draw the label.
Note: Getter function for property labelBrush.
See also setLabelBrush().
QPen QLegendMarker::pen() const
Returns the pen used to draw the outline of the icon.
Note: Getter function for property pen.
See also setPen().
[pure virtual] QAbstractSeries *QLegendMarker::series()
void QLegendMarker::setBrush(const QBrush &brush)
Sets the brush used to fill the icon to brush.
Note: Changing the color of the series also changes the color of the icon.
Note: Setter function for property brush.
See also brush().
void QLegendMarker::setFont(const QFont &font)
Sets the font of the label to font.
Note: Setter function for property font.
See also font().
void QLegendMarker::setLabel(const QString &label)
Sets the label of the marker to label.
Note: Changing the name of a series also changes the label of its marker.
Note: Setter function for property label.
See also label().
void QLegendMarker::setLabelBrush(const QBrush &brush)
Sets the the brush used to draw to label to brush.
Note: Setter function for property labelBrush.
See also labelBrush().
void QLegendMarker::setPen(const QPen &pen)
Sets the pen used to draw the outline of the icon to pen.
Note: Setter function for property pen.
See also pen().
void QLegendMarker::setVisible(bool visible)
Sets the marker's visibility to visible.
Note: Setter function for property visible.
See also isVisible().