| 頭: | #include <QLegend> |
| 實例化: | 圖例 |
| 繼承: | QGraphicsWidget |
| enum | MarkerShape { MarkerShapeDefault, MarkerShapeRectangle, MarkerShapeCircle, MarkerShapeFromSeries } |
|
|
| virtual | ~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 |
| QLegend::MarkerShape | markerShape () const |
| QList<QLegendMarker *> | markers (QAbstractSeries * series = 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 | setMarkerShape (QLegend::MarkerShape shape ) |
| void | setPen (const QPen & pen ) |
| void | setReverseMarkers (bool reverseMarkers = true) |
| void | setShowToolTips (bool show ) |
| bool | showToolTips () const |
| void | backgroundVisibleChanged (bool visible ) |
| void | borderColorChanged (QColor color ) |
| void | colorChanged (QColor color ) |
| void | fontChanged (QFont font ) |
| void | labelColorChanged (QColor color ) |
| void | markerShapeChanged (QLegend::MarkerShape shape ) |
| void | reverseMarkersChanged (bool reverseMarkers ) |
| void | showToolTipsChanged (bool showToolTips ) |
| const QMetaObject | staticMetaObject |
The QLegend 類顯示圖錶的圖例。
A legend is a graphical object that displays the legend of a chart. The legend state is updated by QChart when series change. By default, the legend is attached to the chart, but it can be detached to make it independent of chart layout. Legend objects cannot be created or deleted, but they can be referenced via the QChart 類。
另請參閱 QChart .
This enum describes the shape used when rendering legend marker items.
| 常量 | 值 | 描述 |
|---|---|---|
QLegend::MarkerShapeDefault
|
0
|
Default shape determined by QLegend is used for the marker. This value is supported only for individual QLegendMarker 項。 |
QLegend::MarkerShapeRectangle
|
1
|
Rectangular markers are used. Marker size is determined by font size. |
QLegend::MarkerShapeCircle
|
2
|
Circular markers are used. Marker size is determined by font size. |
QLegend::MarkerShapeFromSeries
|
3
|
The marker shape is determined by the series. In case of a scatter series, the legend marker looks like a scatter dot and is the same size as the dot. In case of a line or spline series, the legend marker looks like a small segment of the line. For other series types, rectangular markers are shown. |
另請參閱 markerShape .
How the legend is aligned with the chart.
可以是 Qt::AlignTop , Qt::AlignBottom , Qt::AlignLeft , Qt::AlignRight . If you set more than one flag, the result is undefined.
訪問函數:
| Qt::Alignment | alignment () const |
| void | setAlignment (Qt::Alignment alignment ) |
This property holds whether the legend background is visible.
訪問函數:
| bool | isBackgroundVisible () const |
| void | setBackgroundVisible (bool visible = true) |
通知程序信號:
| void | backgroundVisibleChanged (bool visible ) |
This property holds the line color of the legend.
訪問函數:
| QColor | borderColor () |
| void | setBorderColor (QColor color ) |
通知程序信號:
| void | borderColorChanged (QColor color ) |
This property holds the background (brush) color of the legend.
If you change the color of the legend, the style of the legend brush is set to Qt::SolidPattern .
訪問函數:
| QColor | color () |
| void | setColor (QColor color ) |
通知程序信號:
| void | colorChanged (QColor color ) |
This property holds the font of the markers used by the legend.
訪問函數:
| QFont | font () const |
| void | setFont (const QFont & font ) |
通知程序信號:
| void | fontChanged (QFont font ) |
This property holds the color of the brush used to draw labels.
訪問函數:
| QColor | labelColor () const |
| void | setLabelColor (QColor color ) |
通知程序信號:
| void | labelColorChanged (QColor color ) |
The default shape of the legend markers. The default value is
MarkerShapeRectangle
.
該特性在 Qt 5.9 引入。
訪問函數:
| QLegend::MarkerShape | markerShape () const |
| void | setMarkerShape (QLegend::MarkerShape shape ) |
通知程序信號:
| void | markerShapeChanged (QLegend::MarkerShape shape ) |
This property holds whether reverse order is used for the markers in the legend.
此特性是
false
在默認情況下。
訪問函數:
| bool | reverseMarkers () |
| void | setReverseMarkers (bool reverseMarkers = true) |
通知程序信號:
| void | reverseMarkersChanged (bool reverseMarkers ) |
This property holds whether tooltips are shown when the text is truncated.
此特性是
false
在默認情況下。
訪問函數:
| bool | showToolTips () const |
| void | setShowToolTips (bool show ) |
通知程序信號:
| void | showToolTipsChanged (bool showToolTips ) |
[虛擬]
QLegend::
~QLegend
()
Destroys the legend object. The legend is always owned by a QChart , so an application should never call this function.
Attaches the legend to a chart. The chart may adjust the layout of the legend.
[signal]
void
QLegend::
backgroundVisibleChanged
(
bool
visible
)
This signal is emitted when the visibility of the legend background changes to visible .
注意: 通知程序信號對於特性 backgroundVisible .
[signal]
void
QLegend::
borderColorChanged
(
QColor
color
)
This signal is emitted when the border color of the legend background changes to color .
注意: 通知程序信號對於特性 borderColor .
Returns the brush used by the legend.
另請參閱 setBrush ().
[signal]
void
QLegend::
colorChanged
(
QColor
color
)
This signal is emitted when the color of the legend background changes to color .
注意: 通知程序信號對於特性 color .
Detaches the legend from the chart. The chart will no longer adjust the layout of the legend.
[signal]
void
QLegend::
fontChanged
(
QFont
font
)
This signal is emitted when the font of the markers of the legend changes to font .
注意: 通知程序信號對於特性 font .
返迴
true
, if the legend is attached to a chart.
Returns the visibility of the legend background.
注意: getter 函數對於特性 backgroundVisible .
Returns the brush used to draw labels.
另請參閱 setLabelBrush ().
[signal]
void
QLegend::
labelColorChanged
(
QColor
color
)
This signal is emitted when the color of the brush used to draw the legend labels changes to color .
注意: 通知程序信號對於特性 labelColor .
Returns the list of markers in the legend. The list can be filtered by specifying the series for which the markers are returned.
Returns the pen used by the legend.
另請參閱 setPen ().
[signal]
void
QLegend::
reverseMarkersChanged
(
bool
reverseMarkers
)
This signal is emitted when the use of reverse order for the markers in the legend is changed to reverseMarkers .
注意: 通知程序信號對於特性 reverseMarkers .
Sets the visibility of the legend background to visible .
注意: setter 函數對於特性 backgroundVisible .
另請參閱 isBackgroundVisible ().
設置 brush that is used to draw the background of the legend.
另請參閱 brush ().
Sets the brush used to draw the legend labels to brush .
另請參閱 labelBrush ().
設置 pen that is used to draw the legend borders.
另請參閱 pen ().
當
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
在默認情況下。
注意: setter 函數對於特性 showToolTips .
另請參閱 showToolTips ().
Returns whether the tooltips are shown for the legend labels when they are elided.
注意: getter 函數對於特性 showToolTips .
另請參閱 setShowToolTips ().
[signal]
void
QLegend::
showToolTipsChanged
(
bool
showToolTips
)
This signal is emitted when the visibility of tooltips is changed to showToolTips .
注意: 通知程序信號對於特性 showToolTips .