QwtLegend − The legend widget.
#include <qwt_legend.h>
Inherits QwtAbstractLegend.
virtual void
updateLegend (const QVariant &, const
QList< QwtLegendData > &) override
Update the entries for an item.
Public Slots inherited from QwtAbstractLegend
virtual void
updateLegend (const QVariant &itemInfo, const
QList< QwtLegendData > &data)=0
Update the entries for a plot item.
void
clicked (const QVariant &itemInfo, int
index)
void checked (const QVariant &itemInfo,
bool on, int index)
QwtLegend
(QWidget *parent=NULL)
virtual ˜QwtLegend ()
Destructor.
void setMaxColumns (uint numColums)
Set the maximum number of entries in a row.
uint maxColumns () const
void setDefaultItemMode (QwtLegendData::Mode)
Set the default mode for legend labels.
QwtLegendData::Mode defaultItemMode () const
QWidget * contentsWidget ()
const QWidget * contentsWidget () const
QWidget * legendWidget (const QVariant &) const
QList< QWidget * > legendWidgets (const
QVariant &) const
QVariant itemInfo (const QWidget *) const
virtual bool eventFilter (QObject *, QEvent *)
override
virtual QSize sizeHint () const override
Return a size hint.
virtual int heightForWidth (int w) const override
QScrollBar * horizontalScrollBar () const
QScrollBar * verticalScrollBar () const
virtual void renderLegend (QPainter *, const QRectF
&, bool fillBackground) const override
virtual void renderItem (QPainter *, const QWidget *,
const QRectF &, bool fillBackground) const
virtual bool isEmpty () const override
virtual int scrollExtent (Qt::Orientation) const
override
Public Member Functions inherited from QwtAbstractLegend
QwtAbstractLegend
(QWidget *parent=NULL)
virtual ˜QwtAbstractLegend ()
Destructor.
void
itemClicked ()
void itemChecked (bool)
virtual QWidget
* createWidget (const QwtLegendData &)
const
Create a widget to be inserted into the legend.
virtual void updateWidget (QWidget *, const
QwtLegendData &)
Update the widget.
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.
Constructor
Parameters
parent Parent widget
Definition at line 258 of file qwt_legend.cpp.
Destructor.
Definition at line 281 of file qwt_legend.cpp.
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()
A signal which is emitted when the user has clicked on a legend label, which is in QwtLegendData::Clickable mode.
Parameters
itemInfo Info for the
item item of the selected legend item
index Index of the legend label in the list of widgets
that are associated with the plot item
Note
clicks are disabled as default
See also
setDefaultItemMode(), defaultItemMode(), QwtPlot::itemToInfo()
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.
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.
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.
Returns
Default item mode
See also
setDefaultItemMode()
Definition at line 344 of file qwt_legend.cpp.
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.
Returns
The preferred height, for a width.
Parameters
width Width
Definition at line 538 of file qwt_legend.cpp.
Returns
Horizontal scrollbar
See also
verticalScrollBar()
Definition at line 364 of file qwt_legend.cpp.
Returns
True, when no item is inserted
Implements QwtAbstractLegend.
Definition at line 810 of file qwt_legend.cpp.
Called internally when the legend has been checked Emits a checked() signal.
Definition at line 638 of file qwt_legend.cpp.
Called internally when the legend has been clicked on. Emits a clicked() signal.
Definition at line 616 of file qwt_legend.cpp.
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.
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.
Returns
List of widgets associated to a item
Parameters
itemInfo Info about an item
See also
legendWidget(), itemInfo(), QwtPlot::itemToInfo()
Definition at line 777 of file qwt_legend.cpp.
Returns
Maximum number of entries in a row
See also
setMaxColumns(), QwtDynGridLayout::maxColumns()
Definition at line 310 of file qwt_legend.cpp.
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.
Render the legend into a given rectangle.
Parameters
painter Painter
rect Bounding rectangle
fillBackground When true, fill rect with the widget
background
See also
renderLegend() is used by QwtPlotRenderer - not by QwtLegend itself
Implements QwtAbstractLegend.
Definition at line 665 of file qwt_legend.cpp.
Return the extent, that is needed for the scrollbars
Parameters
orientation Orientation
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.
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
mode Default item mode
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.
Set the maximum number of entries in a row. F.e when the maximum is set to 1 all items are aligned vertically. 0 means unlimited
Parameters
numColums Maximum number of entries in a row
See also
maxColumns(), QwtDynGridLayout::setMaxColumns()
Definition at line 296 of file qwt_legend.cpp.
Return a size hint.
Definition at line 526 of file qwt_legend.cpp.
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.
Update the widget.
Parameters
widget Usually a
QwtLegendLabel
legendData Attributes to be displayed
See also
createWidget()
Note
When widget is no QwtLegendLabel updateWidget() does nothing.
Definition at line 489 of file qwt_legend.cpp.
Returns
Vertical scrollbar
See also
horizontalScrollBar()
Definition at line 373 of file qwt_legend.cpp.
Generated automatically by Doxygen for Qwt User’s Guide from the source code.