The legend widget.
More...
#include <qwt_legend.h>
The legend widget.
The QwtLegend widget is a tabular arrangement of legend items. Legend items might be any type of widget, but in general they will be a QwtLegendLabel.
- See also
- QwtLegendLabel, QwtPlotItem, QwtPlot
Definition at line 31 of file qwt_legend.h.
◆ QwtLegend()
QwtLegend::QwtLegend |
( |
QWidget * | parent = NULL | ) |
|
|
explicit |
◆ ~QwtLegend()
QwtLegend::~QwtLegend |
( |
| ) |
|
|
virtual |
◆ checked
void QwtLegend::checked |
( |
const QVariant & | itemInfo, |
|
|
bool | on, |
|
|
int | index ) |
|
signal |
A signal which is emitted when the user has clicked on a legend label, which is in QwtLegendData::Checkable mode
- Parameters
-
itemInfo | Info for the item of the selected legend label |
index | Index of the legend label in the list of widgets that are associated with the plot item |
on | True when the legend label is checked |
- Note
- clicks are disabled as default
- See also
- setDefaultItemMode(), defaultItemMode(), QwtPlot::itemToInfo()
◆ clicked
void QwtLegend::clicked |
( |
const QVariant & | itemInfo, |
|
|
int | index ) |
|
signal |
◆ contentsWidget() [1/2]
QWidget * QwtLegend::contentsWidget |
( |
| ) |
|
The contents widget is the only child of the viewport of the internal QScrollArea and the parent widget of all legend items.
- Returns
- Container widget of the legend items
Definition at line 355 of file qwt_legend.cpp.
◆ contentsWidget() [2/2]
const QWidget * QwtLegend::contentsWidget |
( |
| ) |
const |
The contents widget is the only child of the viewport of the internal QScrollArea and the parent widget of all legend items.
- Returns
- Container widget of the legend items
Definition at line 385 of file qwt_legend.cpp.
◆ createWidget()
QWidget * QwtLegend::createWidget |
( |
const QwtLegendData & | legendData | ) |
const |
|
protectedvirtual |
Create a widget to be inserted into the legend.
The default implementation returns a QwtLegendLabel.
- Parameters
-
legendData | Attributes of the legend entry |
- Returns
- Widget representing data on the legend
- Note
- updateWidget() will called soon after createWidget() with the same attributes.
Definition at line 467 of file qwt_legend.cpp.
◆ defaultItemMode()
◆ eventFilter()
bool QwtLegend::eventFilter |
( |
QObject * | object, |
|
|
QEvent * | event ) |
|
overridevirtual |
Handle QEvent::ChildRemoved and QEvent::LayoutRequest events for the contentsWidget().
- Parameters
-
object | Object to be filtered |
event | Event |
- Returns
- Forwarded to QwtAbstractLegend::eventFilter()
Definition at line 559 of file qwt_legend.cpp.
◆ heightForWidth()
int QwtLegend::heightForWidth |
( |
int | width | ) |
const |
|
overridevirtual |
- Returns
- The preferred height, for a width.
- Parameters
-
Definition at line 538 of file qwt_legend.cpp.
◆ horizontalScrollBar()
QScrollBar * QwtLegend::horizontalScrollBar |
( |
| ) |
const |
◆ isEmpty()
bool QwtLegend::isEmpty |
( |
| ) |
const |
|
overridevirtual |
◆ itemChecked
void QwtLegend::itemChecked |
( |
bool | on | ) |
|
|
protectedslot |
◆ itemClicked
void QwtLegend::itemClicked |
( |
| ) |
|
|
protectedslot |
◆ itemInfo()
QVariant QwtLegend::itemInfo |
( |
const QWidget * | widget | ) |
const |
Find the item that is associated to a widget
- Parameters
-
widget | Widget on the legend |
- Returns
- Associated item info
- See also
- legendWidget()
Definition at line 804 of file qwt_legend.cpp.
◆ legendWidget()
QWidget * QwtLegend::legendWidget |
( |
const QVariant & | itemInfo | ) |
const |
- Returns
- First widget in the list of widgets associated to an item
- Parameters
-
itemInfo | Info about an item |
- See also
- itemInfo(), QwtPlot::itemToInfo()
- Note
- Almost all types of items have only one widget
Definition at line 788 of file qwt_legend.cpp.
◆ legendWidgets()
QList< QWidget * > QwtLegend::legendWidgets |
( |
const QVariant & | itemInfo | ) |
const |
◆ maxColumns()
uint QwtLegend::maxColumns |
( |
| ) |
const |
◆ renderItem()
void QwtLegend::renderItem |
( |
QPainter * | painter, |
|
|
const QWidget * | widget, |
|
|
const QRectF & | rect, |
|
|
bool | fillBackground ) const |
|
virtual |
Render a legend entry into a given rectangle.
- Parameters
-
painter | Painter |
widget | Widget representing a legend entry |
rect | Bounding rectangle |
fillBackground | When true, fill rect with the widget background |
- Note
- When widget is not derived from QwtLegendLabel renderItem does nothing beside the background
Definition at line 727 of file qwt_legend.cpp.
◆ renderLegend()
void QwtLegend::renderLegend |
( |
QPainter * | painter, |
|
|
const QRectF & | rect, |
|
|
bool | fillBackground ) const |
|
overridevirtual |
◆ scrollExtent()
int QwtLegend::scrollExtent |
( |
Qt::Orientation | orientation | ) |
const |
|
overridevirtual |
Return the extent, that is needed for the scrollbars
- Parameters
-
- Returns
- The width of the vertical scrollbar for Qt::Horizontal and v.v.
Reimplemented from QwtAbstractLegend.
Definition at line 821 of file qwt_legend.cpp.
◆ setDefaultItemMode()
Set the default mode for legend labels.
Legend labels will be constructed according to the attributes in a QwtLegendData object. When it doesn't contain a value for the QwtLegendData::ModeRole the label will be initialized with the default mode of the legend.
- Parameters
-
- See also
- itemMode(), QwtLegendData::value(), QwtPlotItem::legendData()
- Note
- Changing the mode doesn't have any effect on existing labels.
Definition at line 335 of file qwt_legend.cpp.
◆ setMaxColumns()
void QwtLegend::setMaxColumns |
( |
uint | numColums | ) |
|
◆ sizeHint()
QSize QwtLegend::sizeHint |
( |
| ) |
const |
|
overridevirtual |
◆ updateLegend
void QwtLegend::updateLegend |
( |
const QVariant & | itemInfo, |
|
|
const QList< QwtLegendData > & | legendData ) |
|
overridevirtualslot |
Update the entries for an item.
- Parameters
-
itemInfo | Info for an item |
legendData | List of legend entry attributes for the item |
Definition at line 396 of file qwt_legend.cpp.
◆ updateWidget()
void QwtLegend::updateWidget |
( |
QWidget * | widget, |
|
|
const QwtLegendData & | legendData ) |
|
protectedvirtual |
◆ verticalScrollBar()
QScrollBar * QwtLegend::verticalScrollBar |
( |
| ) |
const |