Classes | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
QwtLegend Class Reference

The legend widget. More...

#include <qwt_legend.h>

Inheritance diagram for QwtLegend:
Inheritance graph
[legend]

Classes

class  PrivateData
 

Public Slots

virtual void updateLegend (const QVariant &, const QList< QwtLegendData > &) QWT_OVERRIDE
 Update the entries for an item. More...
 
- Public Slots inherited from QwtAbstractLegend
virtual void updateLegend (const QVariant &itemInfo, const QList< QwtLegendData > &data)=0
 Update the entries for a plot item. More...
 

Signals

void checked (const QVariant &itemInfo, bool on, int index)
 
void clicked (const QVariant &itemInfo, int index)
 

Public Member Functions

QWidget * contentsWidget ()
 
const QWidget * contentsWidget () const
 
QwtLegendData::Mode defaultItemMode () const
 
virtual bool eventFilter (QObject *, QEvent *) QWT_OVERRIDE
 
virtual int heightForWidth (int w) const QWT_OVERRIDE
 
QScrollBar * horizontalScrollBar () const
 
virtual bool isEmpty () const QWT_OVERRIDE
 
QVariant itemInfo (const QWidget *) const
 
QWidget * legendWidget (const QVariant &) const
 
QList< QWidget * > legendWidgets (const QVariant &) const
 
uint maxColumns () const
 
 QwtLegend (QWidget *parent=NULL)
 
virtual void renderItem (QPainter *, const QWidget *, const QRectF &, bool fillBackground) const
 
virtual void renderLegend (QPainter *, const QRectF &, bool fillBackground) const QWT_OVERRIDE
 
virtual int scrollExtent (Qt::Orientation) const QWT_OVERRIDE
 
void setDefaultItemMode (QwtLegendData::Mode)
 Set the default mode for legend labels. More...
 
void setMaxColumns (uint numColums)
 Set the maximum number of entries in a row. More...
 
virtual QSize sizeHint () const QWT_OVERRIDE
 Return a size hint. More...
 
QScrollBar * verticalScrollBar () const
 
virtual ~QwtLegend ()
 Destructor. More...
 
- Public Member Functions inherited from QwtAbstractLegend
 QwtAbstractLegend (QWidget *parent=NULL)
 
virtual ~QwtAbstractLegend ()
 Destructor. More...
 

Protected Slots

void itemChecked (bool)
 
void itemClicked ()
 

Protected Member Functions

virtual QWidget * createWidget (const QwtLegendData &) const
 Create a widget to be inserted into the legend. More...
 
virtual void updateWidget (QWidget *, const QwtLegendData &)
 Update the widget. More...
 

Private Member Functions

void updateTabOrder ()
 

Private Attributes

PrivateDatam_data
 

Detailed Description

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 & Destructor Documentation

◆ QwtLegend()

QwtLegend::QwtLegend ( QWidget *  parent = NULL)
explicit

Constructor

Parameters
parentParent widget

Definition at line 258 of file qwt_legend.cpp.

◆ ~QwtLegend()

QwtLegend::~QwtLegend ( )
virtual

Destructor.

Definition at line 281 of file qwt_legend.cpp.

Member Function Documentation

◆ 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
itemInfoInfo for the item of the selected legend label
indexIndex of the legend label in the list of widgets that are associated with the plot item
onTrue 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

A signal which is emitted when the user has clicked on a legend label, which is in QwtLegendData::Clickable mode.

Parameters
itemInfoInfo for the item item of the selected legend item
indexIndex 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()

◆ contentsWidget() [1/2]

const 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

◆ 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
legendDataAttributes 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()

QwtLegendData::Mode QwtLegend::defaultItemMode ( ) const
Returns
Default item mode
See also
setDefaultItemMode()

Definition at line 344 of file qwt_legend.cpp.

◆ eventFilter()

bool QwtLegend::eventFilter ( QObject *  object,
QEvent *  event 
)
virtual

Handle QEvent::ChildRemoved and QEvent::LayoutRequest events for the contentsWidget().

Parameters
objectObject to be filtered
eventEvent
Returns
Forwarded to QwtAbstractLegend::eventFilter()

Definition at line 559 of file qwt_legend.cpp.

◆ heightForWidth()

int QwtLegend::heightForWidth ( int  width) const
virtual
Returns
The preferred height, for a width.
Parameters
widthWidth

Definition at line 538 of file qwt_legend.cpp.

◆ horizontalScrollBar()

QScrollBar * QwtLegend::horizontalScrollBar ( ) const
Returns
Horizontal scrollbar
See also
verticalScrollBar()

Definition at line 364 of file qwt_legend.cpp.

◆ isEmpty()

bool QwtLegend::isEmpty ( ) const
virtual
Returns
True, when no item is inserted

Implements QwtAbstractLegend.

Definition at line 810 of file qwt_legend.cpp.

◆ itemChecked

void QwtLegend::itemChecked ( bool  on)
protectedslot

Called internally when the legend has been checked Emits a checked() signal.

Definition at line 638 of file qwt_legend.cpp.

◆ itemClicked

void QwtLegend::itemClicked ( )
protectedslot

Called internally when the legend has been clicked on. Emits a clicked() signal.

Definition at line 616 of file qwt_legend.cpp.

◆ itemInfo()

QVariant QwtLegend::itemInfo ( const QWidget *  widget) const

Find the item that is associated to a widget

Parameters
widgetWidget 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
itemInfoInfo 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
Returns
List of widgets associated to a item
Parameters
itemInfoInfo about an item
See also
legendWidget(), itemInfo(), QwtPlot::itemToInfo()

Definition at line 777 of file qwt_legend.cpp.

◆ maxColumns()

uint QwtLegend::maxColumns ( ) const
Returns
Maximum number of entries in a row
See also
setMaxColumns(), QwtDynGridLayout::maxColumns()

Definition at line 310 of file qwt_legend.cpp.

◆ 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
painterPainter
widgetWidget representing a legend entry
rectBounding rectangle
fillBackgroundWhen 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
virtual

Render the legend into a given rectangle.

Parameters
painterPainter
rectBounding rectangle
fillBackgroundWhen 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.

◆ scrollExtent()

int QwtLegend::scrollExtent ( Qt::Orientation  orientation) const
virtual

Return the extent, that is needed for the scrollbars

Parameters
orientationOrientation
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()

void QwtLegend::setDefaultItemMode ( QwtLegendData::Mode  mode)

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
modeDefault 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.

◆ setMaxColumns()

void QwtLegend::setMaxColumns ( uint  numColums)

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
numColumsMaximum number of entries in a row
See also
maxColumns(), QwtDynGridLayout::setMaxColumns()

Definition at line 296 of file qwt_legend.cpp.

◆ sizeHint()

QSize QwtLegend::sizeHint ( ) const
virtual

Return a size hint.

Definition at line 526 of file qwt_legend.cpp.

◆ updateLegend

void QwtLegend::updateLegend ( const QVariant &  itemInfo,
const QList< QwtLegendData > &  legendData 
)
virtualslot

Update the entries for an item.

Parameters
itemInfoInfo for an item
legendDataList of legend entry attributes for the item

Definition at line 396 of file qwt_legend.cpp.

◆ updateTabOrder()

void QwtLegend::updateTabOrder ( )
private

Definition at line 505 of file qwt_legend.cpp.

◆ updateWidget()

void QwtLegend::updateWidget ( QWidget *  widget,
const QwtLegendData legendData 
)
protectedvirtual

Update the widget.

Parameters
widgetUsually a QwtLegendLabel
legendDataAttributes to be displayed
See also
createWidget()
Note
When widget is no QwtLegendLabel updateWidget() does nothing.

Definition at line 489 of file qwt_legend.cpp.

◆ verticalScrollBar()

QScrollBar * QwtLegend::verticalScrollBar ( ) const
Returns
Vertical scrollbar
See also
horizontalScrollBar()

Definition at line 373 of file qwt_legend.cpp.

Member Data Documentation

◆ m_data

PrivateData* QwtLegend::m_data
private

Definition at line 115 of file qwt_legend.h.


The documentation for this class was generated from the following files:


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:50