QLegendMarker Class | Qt Charts 5.7

Qt 5.7 | Qt Charts | C++ Classes | QLegendMarker

Qt 5.7.1 Reference Documentation

# QLegendMarker Class

LegendMarker object. More...

Header: | #include <QLegendMarker>
Inherited By: | QAreaLegendMarker, QBarLegendMarker, QBoxPlotLegendMarker, QPieLegendMarker, and QXYLegendMarker

- List of all members, including inherited members

## Public Types

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

## Properties

brush : QBrush font : QFont label : QString | labelBrush : QBrush pen : QPen visible : bool

## 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 | setVisible(bool visible)
virtual LegendMarkerType | type() = 0

## Signals

void | brushChanged()
void | clicked()
void | fontChanged()
void | hovered(bool status)
void | labelBrushChanged()
void | labelChanged()
void | penChanged()
void | visibleChanged()

## Detailed Description

LegendMarker object.

QLegendMarker is abstract object that can be used to access markers inside QLegend. Legend marker consists of two items: The colored box, which reflects the color of series and label, which is the name of series (or label of slice/barset in case of pie or bar series) The QLegendMarker is always related to one series.

See also QLegend.

## Member Type Documentation

### enum QLegendMarker::LegendMarkerType

The type of the legendmarker object.

Constant | Value
--- | ---
`QLegendMarker::LegendMarkerTypeArea` | `0`
`QLegendMarker::LegendMarkerTypeBar` | `1`
`QLegendMarker::LegendMarkerTypePie` | `2`
`QLegendMarker::LegendMarkerTypeXY` | `3`
`QLegendMarker::LegendMarkerTypeBoxPlot` | `4`

## Property Documentation

### brush : QBrush

Brush of the marker. This is the inside of the colored square.

Access functions:

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

Notifier signal:

void | brushChanged()

### font : QFont

Font of the label

Access functions:

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

Notifier signal:

void | fontChanged()

### label : QString

Label of the marker. This is the text that is shown in legend.

Access functions:

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

Notifier signal:

void | labelChanged()

### labelBrush : QBrush

Brush of the label

Access functions:

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

Notifier signal:

void | labelBrushChanged()

### pen : QPen

Pen of the marker. This is the outline of the colored square.

Access functions:

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

Notifier signal:

void | penChanged()

### visible : bool

Visibility of the legend marker. Affects label and the colored square.

Access functions:

bool | isVisible() const
void | setVisible(bool visible)

Notifier signal:

void | visibleChanged()

## Member Function Documentation

### `[virtual]` QLegendMarker::~QLegendMarker()

Destructor of marker

### QBrush QLegendMarker::brush() const

Returns the brush of marker item

Note: Getter function for property brush.

See also setBrush().

### `[signal]` void QLegendMarker::brushChanged()

This signal is emitted when the brush of the legend marker has changed.

Note: Notifier signal for property brush.

### `[signal]` void QLegendMarker::clicked()

This signal is emitted, when marker is clicked with mouse.

### QFont QLegendMarker::font() const

Retuns the font of label

Note: Getter function for property font.

See also setFont().

### `[signal]` void QLegendMarker::fontChanged()

This signal is emitted when the (label) font of the legend marker has changed.

Note: Notifier signal for property font.

### `[signal]` void QLegendMarker::hovered(bool status)

This signal is emitted, when mouse is hovered over marker. status is true, when mouse enters the marker and false when it leaves the marker.

### bool QLegendMarker::isVisible() const

Returns 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 which is used to draw label.

Note: Getter function for property labelBrush.

See also setLabelBrush().

### `[signal]` void QLegendMarker::labelBrushChanged()

This signal is emitted when the label brush of the legend marker has changed.

Note: Notifier signal for property labelBrush.

### `[signal]` void QLegendMarker::labelChanged()

This signal is emitted when the label of the legend marker has changed.

Note: Notifier signal for property label.

### QPen QLegendMarker::pen() const

Returns the pen of marker item

Note: Getter function for property pen.

See also setPen().

### `[signal]` void QLegendMarker::penChanged()

This signal is emitted when the pen of the legend marker has changed.

Note: Notifier signal for property pen.

### `[pure virtual]` QAbstractSeries *QLegendMarker::series()

Returns pointer to series, which is related to this marker. Marker is always related to some series.

### void QLegendMarker::setBrush(const QBrush &brush)

Sets the brush of marker item. Note that changing color of the series also changes this.

Note: Setter function for property brush.

See also brush().

### void QLegendMarker::setFont(const QFont &font)

Sets the font of label

Note: Setter function for property font.

See also font().

### void QLegendMarker::setLabel(const QString &label)

Sets the label of marker. Note that changing name of series will also change label of its marker.

Note: Setter function for property label.

See also label().

### void QLegendMarker::setLabelBrush(const QBrush &brush)

Sets the brush of label

Note: Setter function for property labelBrush.

See also labelBrush().

### void QLegendMarker::setPen(const QPen &pen)

Sets the pen of marker item

Note: Setter function for property pen.

See also pen().

### void QLegendMarker::setVisible(bool visible)

Sets markers visibility to visible

Note: Setter function for property visible.

See also isVisible().

### `[pure virtual]` LegendMarkerType QLegendMarker::type()

Returns the type of legendmarker. Type depends of the related series. LegendMarkerTypeXY is used for all QXYSeries derived classes.

### `[signal]` void QLegendMarker::visibleChanged()

This signal is emitted when the visibility of the legend marker has changed.

Note: Notifier signal for property visible.