The legend widget. More...
#include <qwt_legend.h>
Classes | |
class | PrivateData |
Public Slots | |
virtual void | updateLegend (const QVariant &, const QList< QwtLegendData > &) |
Update the entries for an item. | |
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 *) |
virtual int | heightForWidth (int w) const |
QScrollBar * | horizontalScrollBar () const |
virtual bool | isEmpty () const |
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 |
virtual int | scrollExtent (Qt::Orientation) const |
void | setDefaultItemMode (QwtLegendData::Mode) |
Set the default mode for legend labels. | |
void | setMaxColumns (uint numColums) |
Set the maximum number of entries in a row. | |
virtual QSize | sizeHint () const |
Return a size hint. | |
QScrollBar * | verticalScrollBar () const |
virtual | ~QwtLegend () |
Destructor. | |
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. | |
virtual void | updateWidget (QWidget *widget, const QwtLegendData &data) |
Update the widget. | |
Private Member Functions | |
void | updateTabOrder () |
Private Attributes | |
PrivateData * | d_data |
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.
Definition at line 29 of file qwt_legend.h.
QwtLegend::QwtLegend | ( | QWidget * | parent = NULL | ) | [explicit] |
QwtLegend::~QwtLegend | ( | ) | [virtual] |
Destructor.
Definition at line 277 of file qwt_legend.cpp.
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
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 |
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.
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 |
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.
Definition at line 349 of file qwt_legend.cpp.
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.
Definition at line 379 of file qwt_legend.cpp.
QWidget * QwtLegend::createWidget | ( | const QwtLegendData & | data | ) | const [protected, virtual] |
Create a widget to be inserted into the legend.
The default implementation returns a QwtLegendLabel.
data | Attributes of the legend entry |
Definition at line 459 of file qwt_legend.cpp.
Definition at line 338 of file qwt_legend.cpp.
bool QwtLegend::eventFilter | ( | QObject * | object, |
QEvent * | event | ||
) | [virtual] |
Handle QEvent::ChildRemoved andQEvent::LayoutRequest events for the contentsWidget().
object | Object to be filtered |
event | Event |
Definition at line 551 of file qwt_legend.cpp.
int QwtLegend::heightForWidth | ( | int | width | ) | const [virtual] |
width | Width |
Definition at line 530 of file qwt_legend.cpp.
QScrollBar * QwtLegend::horizontalScrollBar | ( | ) | const |
Definition at line 358 of file qwt_legend.cpp.
bool QwtLegend::isEmpty | ( | ) | const [virtual] |
Implements QwtAbstractLegend.
Definition at line 789 of file qwt_legend.cpp.
void QwtLegend::itemChecked | ( | bool | on | ) | [protected, slot] |
Called internally when the legend has been checked Emits a checked() signal.
Definition at line 624 of file qwt_legend.cpp.
void QwtLegend::itemClicked | ( | ) | [protected, slot] |
Called internally when the legend has been clicked on. Emits a clicked() signal.
Definition at line 602 of file qwt_legend.cpp.
QVariant QwtLegend::itemInfo | ( | const QWidget * | widget | ) | const |
Find the item that is associated to a widget
widget | Widget on the legend |
Definition at line 783 of file qwt_legend.cpp.
QWidget * QwtLegend::legendWidget | ( | const QVariant & | itemInfo | ) | const |
itemInfo | Info about an item |
Definition at line 767 of file qwt_legend.cpp.
QList< QWidget * > QwtLegend::legendWidgets | ( | const QVariant & | itemInfo | ) | const |
itemInfo | Info about an item |
Definition at line 756 of file qwt_legend.cpp.
uint QwtLegend::maxColumns | ( | ) | const |
Definition at line 304 of file qwt_legend.cpp.
void QwtLegend::renderItem | ( | QPainter * | painter, |
const QWidget * | widget, | ||
const QRectF & | rect, | ||
bool | fillBackground | ||
) | const [virtual] |
Render a legend entry into a given rectangle.
painter | Painter |
widget | Widget representing a legend entry |
rect | Bounding rectangle |
fillBackground | When true, fill rect with the widget background |
Definition at line 714 of file qwt_legend.cpp.
void QwtLegend::renderLegend | ( | QPainter * | painter, |
const QRectF & | rect, | ||
bool | fillBackground | ||
) | const [virtual] |
Render the legend into a given rectangle.
painter | Painter |
rect | Bounding rectangle |
fillBackground | When true, fill rect with the widget background |
Implements QwtAbstractLegend.
Definition at line 651 of file qwt_legend.cpp.
int QwtLegend::scrollExtent | ( | Qt::Orientation | orientation | ) | const [virtual] |
Return the extent, that is needed for the scrollbars
orientation | Orientation ( |
Reimplemented from QwtAbstractLegend.
Definition at line 800 of file qwt_legend.cpp.
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.
mode | Default item mode |
Definition at line 329 of file qwt_legend.cpp.
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
numColums | Maximum number of entries in a row |
Definition at line 292 of file qwt_legend.cpp.
QSize QwtLegend::sizeHint | ( | ) | const [virtual] |
Return a size hint.
Definition at line 518 of file qwt_legend.cpp.
void QwtLegend::updateLegend | ( | const QVariant & | itemInfo, |
const QList< QwtLegendData > & | data | ||
) | [virtual, slot] |
Update the entries for an item.
itemInfo | Info for an item |
data | List of legend entry attributes for the item |
Implements QwtAbstractLegend.
Definition at line 390 of file qwt_legend.cpp.
void QwtLegend::updateTabOrder | ( | ) | [private] |
Definition at line 497 of file qwt_legend.cpp.
void QwtLegend::updateWidget | ( | QWidget * | widget, |
const QwtLegendData & | data | ||
) | [protected, virtual] |
Update the widget.
widget | Usually a QwtLegendLabel |
data | Attributes to be displayed |
Definition at line 481 of file qwt_legend.cpp.
QScrollBar * QwtLegend::verticalScrollBar | ( | ) | const |
Definition at line 367 of file qwt_legend.cpp.
PrivateData* QwtLegend::d_data [private] |
Definition at line 113 of file qwt_legend.h.