QLegend Class
Legend object. More...
Header: | #include <QLegend> |
Instantiated By: | Legend |
Inherits: | QGraphicsWidget |
Properties
|
|
- 14 properties inherited from QGraphicsWidget
- 12 properties inherited from QGraphicsObject
Public Functions
~QLegend() | |
Qt::Alignment | alignment() const |
void | attachToChart() |
QColor | borderColor() |
QBrush | brush() const |
QColor | color() |
void | detachFromChart() |
QFont | font() const |
bool | isAttachedToChart() |
bool | isBackgroundVisible() const |
QBrush | labelBrush() const |
QColor | labelColor() const |
QList<QLegendMarker *> | markers(QAbstractSeries *series = Q_NULLPTR) const |
QPen | pen() const |
bool | reverseMarkers() |
void | setAlignment(Qt::Alignment alignment) |
void | setBackgroundVisible(bool visible = true) |
void | setBorderColor(QColor color) |
void | setBrush(const QBrush &brush) |
void | setColor(QColor color) |
void | setFont(const QFont &font) |
void | setLabelBrush(const QBrush &brush) |
void | setLabelColor(QColor color) |
void | setPen(const QPen &pen) |
void | setReverseMarkers(bool reverseMarkers = true) |
void | setShowToolTips(bool show) |
bool | showToolTips() const |
- 53 public functions inherited from QGraphicsWidget
- 35 public functions inherited from QGraphicsLayoutItem
- 2 public functions inherited from QGraphicsObject
- 176 public functions inherited from QGraphicsItem
Signals
void | backgroundVisibleChanged(bool visible) |
void | borderColorChanged(QColor color) |
void | colorChanged(QColor color) |
void | fontChanged(QFont font) |
void | labelColorChanged(QColor color) |
void | reverseMarkersChanged(bool reverseMarkers) |
void | showToolTipsChanged(bool showToolTips) |
- 1 signal inherited from QGraphicsWidget
- 9 signals inherited from QGraphicsObject
Additional Inherited Members
- 1 public slot inherited from QGraphicsWidget
- 1 public variable inherited from QGraphicsWidget
- 2 public variables inherited from QGraphicsItem
- 1 static public member inherited from QGraphicsWidget
- 24 protected functions inherited from QGraphicsWidget
- 3 protected functions inherited from QGraphicsLayoutItem
- 1 protected function inherited from QGraphicsObject
- 24 protected functions inherited from QGraphicsItem
- 1 protected slot inherited from QGraphicsObject
- 1 protected type inherited from QGraphicsLayoutItem
- 1 protected type inherited from QGraphicsItem
Detailed Description
Legend object.
QLegend is a graphical object for displaying the legend of the chart. Legend state is updated by QChart, when series have been changed. By default, legend is drawn by QChart, but user can set a new parent to legend and handle the drawing manually. User isn't supposed to create or delete legend objects, but can reference it via QChart class.
See also QChart.
Property Documentation
alignment : Qt::Alignment
This property holds the alignment of the legend.
Legend paints on the defined position in the chart. The following alignments are supported: Qt::AlignTop, Qt::AlignBottom, Qt::AlignLeft, Qt::AlignRight. If you set more than one flag the result is undefined.
Access functions:
Qt::Alignment | alignment() const |
void | setAlignment(Qt::Alignment alignment) |
backgroundVisible : bool
Whether the legend background is visible or not.
Access functions:
bool | isBackgroundVisible() const |
void | setBackgroundVisible(bool visible = true) |
Notifier signal:
void | backgroundVisibleChanged(bool visible) |
borderColor : QColor
The border color of the legend, i.e. the line color.
Access functions:
QColor | borderColor() |
void | setBorderColor(QColor color) |
Notifier signal:
void | borderColorChanged(QColor color) |
color : QColor
The color of the legend, i.e. the background (brush) color. Note that if you change the color of the legend, the style of the legend brush is set to Qt::SolidPattern.
Access functions:
QColor | color() |
void | setColor(QColor color) |
Notifier signal:
void | colorChanged(QColor color) |
font : QFont
The font of markers used by legend.
Access functions:
QFont | font() const |
void | setFont(const QFont &font) |
Notifier signal:
void | fontChanged(QFont font) |
labelColor : QColor
The color of brush used to draw labels.
Access functions:
QColor | labelColor() const |
void | setLabelColor(QColor color) |
Notifier signal:
void | labelColorChanged(QColor color) |
reverseMarkers : bool
Whether reverse order is used for the markers in legend or not. False by default.
Access functions:
bool | reverseMarkers() |
void | setReverseMarkers(bool reverseMarkers = true) |
Notifier signal:
void | reverseMarkersChanged(bool reverseMarkers) |
showToolTips : bool
Whether tooltips are shown when the text is truncated. This is false by default.
This will not have any effect when used in QML.
Access functions:
bool | showToolTips() const |
void | setShowToolTips(bool show) |
Notifier signal:
void | showToolTipsChanged(bool showToolTips) |
Member Function Documentation
QLegend::~QLegend()
Destroys the legend object. Legend is always owned by a QChart, so an application should never call this.
void QLegend::attachToChart()
Attaches the legend to chart. Chart may change layout of the legend.
[signal]
void QLegend::backgroundVisibleChanged(bool visible)
The visibility of the legend background changed to visible.
Note: Notifier signal for property backgroundVisible.
[signal]
void QLegend::borderColorChanged(QColor color)
The border color of the legend background changed to color.
Note: Notifier signal for property borderColor.
QBrush QLegend::brush() const
Returns the brush used by legend.
See also setBrush().
[signal]
void QLegend::colorChanged(QColor color)
The color of the legend background changed to color.
Note: Notifier signal for property color.
void QLegend::detachFromChart()
Detaches the legend from chart. Chart won't change layout of the legend.
[signal]
void QLegend::fontChanged(QFont font)
The font of markers of the legend changed to font.
Note: Notifier signal for property font.
bool QLegend::isAttachedToChart()
Returns true, if legend is attached to chart.
bool QLegend::isBackgroundVisible() const
Returns the visibility of legend background
Note: Getter function for property backgroundVisible.
QBrush QLegend::labelBrush() const
Brush used to draw labels.
See also setLabelBrush().
[signal]
void QLegend::labelColorChanged(QColor color)
This signal is emitted when the color of brush used to draw labels has changed to color.
Note: Notifier signal for property labelColor.
QList<QLegendMarker *> QLegend::markers(QAbstractSeries *series = Q_NULLPTR) const
Returns the list of markers in legend. The list can be filtered with series parameter. If series is given, only markers related to that series are returned.
QPen QLegend::pen() const
Returns the pen used by legend.
See also setPen().
[signal]
void QLegend::reverseMarkersChanged(bool reverseMarkers)
The use of reverse order for the markers in legend is changed to reverseMarkers.
Note: Notifier signal for property reverseMarkers.
void QLegend::setBackgroundVisible(bool visible = true)
Sets the visibility of legend background to visible
Note: Setter function for property backgroundVisible.
See also isBackgroundVisible().
void QLegend::setBrush(const QBrush &brush)
Sets the brush of legend. Brush affects the background of legend.
See also brush().
void QLegend::setLabelBrush(const QBrush &brush)
Set brush used to draw labels to brush.
See also labelBrush().
void QLegend::setPen(const QPen &pen)
Sets the pen of legend. Pen affects the legend borders.
See also pen().
void QLegend::setShowToolTips(bool show)
When show is true, the legend labels will show a tooltip when the mouse hovers over them if the label itself is shown elided. This is false by default.
Note: Setter function for property showToolTips.
See also showToolTips().
bool QLegend::showToolTips() const
Returns whether the tooltips are shown or not for the legend labels when they are elided.
Note: Getter function for property showToolTips.
See also setShowToolTips().
[signal]
void QLegend::showToolTipsChanged(bool showToolTips)
This signal is emitted when the visibility of tooltips is changed to showToolTips.
Note: Notifier signal for property showToolTips.