QLegendMarker Class

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

头: #include <QLegendMarker>
继承: QObject
继承者: QAreaLegendMarker , QBarLegendMarker , QBoxPlotLegendMarker , QCandlestickLegendMarker , QPieLegendMarker ,和 QXYLegendMarker

公共类型

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

特性

公共函数

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

信号

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

静态公共成员

const QMetaObject staticMetaObject

保护变量

QScopedPointer<QLegendMarkerPrivate> d_ptr

额外继承成员

详细描述

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.

另请参阅 QLegend .

成员类型文档编制

enum QLegendMarker:: LegendMarkerType

The type of the legend marker object.

常量 描述
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.

该枚举在 Qt 5.8 引入或被修改。

特性文档编制

brush : QBrush

This property holds the brush used to fill the icon.

访问函数:

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

通知程序信号:

void brushChanged ()

font : QFont

This property holds the font of the label.

访问函数:

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

通知程序信号:

void fontChanged ()

label : QString

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

访问函数:

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

通知程序信号:

void labelChanged ()

labelBrush : QBrush

This property holds the brush of the label.

访问函数:

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

通知程序信号:

void labelBrushChanged ()

pen : QPen

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

访问函数:

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

通知程序信号:

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 特性。

访问函数:

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

通知程序信号:

void shapeChanged ()

visible : bool

This property holds the visibility of the legend marker.

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

访问函数:

bool isVisible () const
void setVisible (bool visible )

通知程序信号:

void visibleChanged ()

成员函数文档编制

[虚拟] QLegendMarker:: ~QLegendMarker ()

Removes the legend marker.

QBrush QLegendMarker:: brush () const

Returns the brush used to fill the icon.

注意: getter 函数对于特性 brush .

另请参阅 setBrush ().

[signal] void QLegendMarker:: brushChanged ()

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

注意: 通知程序信号对于特性 brush .

[signal] void QLegendMarker:: clicked ()

This signal is emitted when the legend marker is clicked.

QFont QLegendMarker:: font () const

Retuns the font of the label.

注意: getter 函数对于特性 font .

另请参阅 setFont ().

[signal] void QLegendMarker:: fontChanged ()

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

注意: 通知程序信号对于特性 font .

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

This signal is emitted when a mouse is hovered over the legend marker. When the mouse moves over the marker, status turns true , and when the mouse moves away again, it turns false .

bool QLegendMarker:: isVisible () const

Returns the visibility of the marker.

注意: getter 函数对于特性 visible .

QString QLegendMarker:: label () const

Returns the label of the marker.

注意: getter 函数对于特性 label .

另请参阅 setLabel ().

QBrush QLegendMarker:: labelBrush () const

Returns the brush that is used to draw the label.

注意: getter 函数对于特性 labelBrush .

另请参阅 setLabelBrush ().

[signal] void QLegendMarker:: labelBrushChanged ()

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

注意: 通知程序信号对于特性 labelBrush .

[signal] void QLegendMarker:: labelChanged ()

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

注意: 通知程序信号对于特性 label .

QPen QLegendMarker:: pen () const

Returns the pen used to draw the outline of the icon.

注意: getter 函数对于特性 pen .

另请参阅 setPen ().

[signal] void QLegendMarker:: penChanged ()

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

注意: 通知程序信号对于特性 pen .

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

Returns a pointer to the series that is related to this legend marker. A legend marker is always related to a series.

void QLegendMarker:: setBrush (const QBrush & brush )

Sets the brush used to fill the icon to brush .

注意: Changing the color of the series also changes the color of the icon.

注意: setter 函数对于特性 brush .

另请参阅 brush ().

void QLegendMarker:: setFont (const QFont & font )

Sets the font of the label to font .

注意: setter 函数对于特性 font .

另请参阅 font ().

void QLegendMarker:: setLabel (const QString & label )

Sets the label of the marker to label .

注意: Changing the name of a series also changes the label of its marker.

注意: setter 函数对于特性 label .

另请参阅 label ().

void QLegendMarker:: setLabelBrush (const QBrush & brush )

Sets the the brush used to draw to label to brush .

注意: setter 函数对于特性 labelBrush .

另请参阅 labelBrush ().

void QLegendMarker:: setPen (const QPen & pen )

设置 pen used to draw the outline of the icon to pen .

注意: setter 函数对于特性 pen .

另请参阅 pen ().

void QLegendMarker:: setVisible ( bool visible )

Sets the marker's visibility to visible .

注意: setter 函数对于特性 visible .

另请参阅 isVisible ().

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

Returns the type of the legend marker for the related series, pie slice, or bar set.

另请参阅 LegendMarkerType .

[signal] void QLegendMarker:: visibleChanged ()

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

注意: 通知程序信号对于特性 visible .