.TH "QwtLegend" 3 "Sun Jul 18 2021" "Version 6.2.0" "Qwt User's Guide" \" -*- nroff -*- .ad l .nh .SH NAME QwtLegend \- The legend widget\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBQwtAbstractLegend\fP\&. .SS "Public Slots" .in +1c .ti -1c .RI "virtual void \fBupdateLegend\fP (const QVariant &, const \fBQList\fP< \fBQwtLegendData\fP > &) override" .br .RI "Update the entries for an item\&. " .in -1c .SS "Signals" .in +1c .ti -1c .RI "void \fBclicked\fP (const QVariant &\fBitemInfo\fP, int index)" .br .ti -1c .RI "void \fBchecked\fP (const QVariant &\fBitemInfo\fP, bool on, int index)" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBQwtLegend\fP (QWidget *parent=NULL)" .br .ti -1c .RI "virtual \fB~QwtLegend\fP ()" .br .RI "Destructor\&. " .ti -1c .RI "void \fBsetMaxColumns\fP (uint numColums)" .br .RI "Set the maximum number of entries in a row\&. " .ti -1c .RI "uint \fBmaxColumns\fP () const" .br .ti -1c .RI "void \fBsetDefaultItemMode\fP (\fBQwtLegendData::Mode\fP)" .br .RI "Set the default mode for legend labels\&. " .ti -1c .RI "\fBQwtLegendData::Mode\fP \fBdefaultItemMode\fP () const" .br .ti -1c .RI "QWidget * \fBcontentsWidget\fP ()" .br .ti -1c .RI "const QWidget * \fBcontentsWidget\fP () const" .br .ti -1c .RI "QWidget * \fBlegendWidget\fP (const QVariant &) const" .br .ti -1c .RI "\fBQList\fP< QWidget * > \fBlegendWidgets\fP (const QVariant &) const" .br .ti -1c .RI "QVariant \fBitemInfo\fP (const QWidget *) const" .br .ti -1c .RI "virtual bool \fBeventFilter\fP (QObject *, QEvent *) override" .br .ti -1c .RI "virtual QSize \fBsizeHint\fP () const override" .br .RI "Return a size hint\&. " .ti -1c .RI "virtual int \fBheightForWidth\fP (int w) const override" .br .ti -1c .RI "QScrollBar * \fBhorizontalScrollBar\fP () const" .br .ti -1c .RI "QScrollBar * \fBverticalScrollBar\fP () const" .br .ti -1c .RI "virtual void \fBrenderLegend\fP (QPainter *, const QRectF &, bool fillBackground) const override" .br .ti -1c .RI "virtual void \fBrenderItem\fP (QPainter *, const QWidget *, const QRectF &, bool fillBackground) const" .br .ti -1c .RI "virtual bool \fBisEmpty\fP () const override" .br .ti -1c .RI "virtual int \fBscrollExtent\fP (Qt::Orientation) const override" .br .in -1c .SS "Protected Slots" .in +1c .ti -1c .RI "void \fBitemClicked\fP ()" .br .ti -1c .RI "void \fBitemChecked\fP (bool)" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "virtual QWidget * \fBcreateWidget\fP (const \fBQwtLegendData\fP &) const" .br .RI "Create a widget to be inserted into the legend\&. " .ti -1c .RI "virtual void \fBupdateWidget\fP (QWidget *, const \fBQwtLegendData\fP &)" .br .RI "Update the widget\&. " .in -1c .SH "Detailed Description" .PP The legend widget\&. The \fBQwtLegend\fP widget is a tabular arrangement of legend items\&. Legend items might be any type of widget, but in general they will be a \fBQwtLegendLabel\fP\&. .PP \fBSee also\fP .RS 4 \fBQwtLegendLabel\fP, \fBQwtPlotItem\fP, \fBQwtPlot\fP .RE .PP .PP Definition at line 31 of file qwt_legend\&.h\&. .SH "Constructor & Destructor Documentation" .PP .SS "QwtLegend::QwtLegend (QWidget * parent = \fCNULL\fP)\fC [explicit]\fP" Constructor .PP \fBParameters\fP .RS 4 \fIparent\fP Parent widget .RE .PP .PP Definition at line 258 of file qwt_legend\&.cpp\&. .SH "Member Function Documentation" .PP .SS "void QwtLegend::checked (const QVariant & itemInfo, bool on, int index)\fC [signal]\fP" A signal which is emitted when the user has clicked on a legend label, which is in \fBQwtLegendData::Checkable\fP mode .PP \fBParameters\fP .RS 4 \fIitemInfo\fP Info for the item of the selected legend label .br \fIindex\fP Index of the legend label in the list of widgets that are associated with the plot item .br \fIon\fP True when the legend label is checked .RE .PP \fBNote\fP .RS 4 clicks are disabled as default .RE .PP \fBSee also\fP .RS 4 \fBsetDefaultItemMode()\fP, \fBdefaultItemMode()\fP, \fBQwtPlot::itemToInfo()\fP .RE .PP .SS "void QwtLegend::clicked (const QVariant & itemInfo, int index)\fC [signal]\fP" A signal which is emitted when the user has clicked on a legend label, which is in \fBQwtLegendData::Clickable\fP mode\&. .PP \fBParameters\fP .RS 4 \fIitemInfo\fP Info for the item item of the selected legend item .br \fIindex\fP Index of the legend label in the list of widgets that are associated with the plot item .RE .PP \fBNote\fP .RS 4 clicks are disabled as default .RE .PP \fBSee also\fP .RS 4 \fBsetDefaultItemMode()\fP, \fBdefaultItemMode()\fP, \fBQwtPlot::itemToInfo()\fP .RE .PP .SS "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\&. .PP \fBReturns\fP .RS 4 Container widget of the legend items .RE .PP .PP Definition at line 355 of file qwt_legend\&.cpp\&. .SS "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\&. .PP \fBReturns\fP .RS 4 Container widget of the legend items .RE .PP .PP Definition at line 385 of file qwt_legend\&.cpp\&. .SS "QWidget * QwtLegend::createWidget (const \fBQwtLegendData\fP & legendData) const\fC [protected]\fP, \fC [virtual]\fP" .PP Create a widget to be inserted into the legend\&. The default implementation returns a \fBQwtLegendLabel\fP\&. .PP \fBParameters\fP .RS 4 \fIlegendData\fP Attributes of the legend entry .RE .PP \fBReturns\fP .RS 4 Widget representing data on the legend .RE .PP \fBNote\fP .RS 4 \fBupdateWidget()\fP will called soon after \fBcreateWidget()\fP with the same attributes\&. .RE .PP .PP Definition at line 467 of file qwt_legend\&.cpp\&. .SS "\fBQwtLegendData::Mode\fP QwtLegend::defaultItemMode () const" .PP \fBReturns\fP .RS 4 Default item mode .RE .PP \fBSee also\fP .RS 4 \fBsetDefaultItemMode()\fP .RE .PP .PP Definition at line 344 of file qwt_legend\&.cpp\&. .SS "bool QwtLegend::eventFilter (QObject * object, QEvent * event)\fC [override]\fP, \fC [virtual]\fP" Handle QEvent::ChildRemoved and QEvent::LayoutRequest events for the \fBcontentsWidget()\fP\&. .PP \fBParameters\fP .RS 4 \fIobject\fP Object to be filtered .br \fIevent\fP Event .RE .PP \fBReturns\fP .RS 4 Forwarded to QwtAbstractLegend::eventFilter() .RE .PP .PP Definition at line 559 of file qwt_legend\&.cpp\&. .SS "int QwtLegend::heightForWidth (int width) const\fC [override]\fP, \fC [virtual]\fP" .PP \fBReturns\fP .RS 4 The preferred height, for a width\&. .RE .PP \fBParameters\fP .RS 4 \fIwidth\fP Width .RE .PP .PP Definition at line 538 of file qwt_legend\&.cpp\&. .SS "QScrollBar * QwtLegend::horizontalScrollBar () const" .PP \fBReturns\fP .RS 4 Horizontal scrollbar .RE .PP \fBSee also\fP .RS 4 \fBverticalScrollBar()\fP .RE .PP .PP Definition at line 364 of file qwt_legend\&.cpp\&. .SS "bool QwtLegend::isEmpty () const\fC [override]\fP, \fC [virtual]\fP" .PP \fBReturns\fP .RS 4 True, when no item is inserted .RE .PP .PP Implements \fBQwtAbstractLegend\fP\&. .PP Definition at line 810 of file qwt_legend\&.cpp\&. .SS "void QwtLegend::itemChecked (bool on)\fC [protected]\fP, \fC [slot]\fP" Called internally when the legend has been checked Emits a \fBchecked()\fP signal\&. .PP Definition at line 638 of file qwt_legend\&.cpp\&. .SS "void QwtLegend::itemClicked ()\fC [protected]\fP, \fC [slot]\fP" Called internally when the legend has been clicked on\&. Emits a \fBclicked()\fP signal\&. .PP Definition at line 616 of file qwt_legend\&.cpp\&. .SS "QVariant QwtLegend::itemInfo (const QWidget * widget) const" Find the item that is associated to a widget .PP \fBParameters\fP .RS 4 \fIwidget\fP Widget on the legend .RE .PP \fBReturns\fP .RS 4 Associated item info .RE .PP \fBSee also\fP .RS 4 \fBlegendWidget()\fP .RE .PP .PP Definition at line 804 of file qwt_legend\&.cpp\&. .SS "QWidget * QwtLegend::legendWidget (const QVariant & itemInfo) const" .PP \fBReturns\fP .RS 4 First widget in the list of widgets associated to an item .RE .PP \fBParameters\fP .RS 4 \fIitemInfo\fP Info about an item .RE .PP \fBSee also\fP .RS 4 \fBitemInfo()\fP, \fBQwtPlot::itemToInfo()\fP .RE .PP \fBNote\fP .RS 4 Almost all types of items have only one widget .RE .PP .PP Definition at line 788 of file qwt_legend\&.cpp\&. .SS "\fBQList\fP< QWidget * > QwtLegend::legendWidgets (const QVariant & itemInfo) const" .PP \fBReturns\fP .RS 4 List of widgets associated to a item .RE .PP \fBParameters\fP .RS 4 \fIitemInfo\fP Info about an item .RE .PP \fBSee also\fP .RS 4 \fBlegendWidget()\fP, \fBitemInfo()\fP, \fBQwtPlot::itemToInfo()\fP .RE .PP .PP Definition at line 777 of file qwt_legend\&.cpp\&. .SS "uint QwtLegend::maxColumns () const" .PP \fBReturns\fP .RS 4 Maximum number of entries in a row .RE .PP \fBSee also\fP .RS 4 \fBsetMaxColumns()\fP, \fBQwtDynGridLayout::maxColumns()\fP .RE .PP .PP Definition at line 310 of file qwt_legend\&.cpp\&. .SS "void QwtLegend::renderItem (QPainter * painter, const QWidget * widget, const QRectF & rect, bool fillBackground) const\fC [virtual]\fP" Render a legend entry into a given rectangle\&. .PP \fBParameters\fP .RS 4 \fIpainter\fP Painter .br \fIwidget\fP Widget representing a legend entry .br \fIrect\fP Bounding rectangle .br \fIfillBackground\fP When true, fill rect with the widget background .RE .PP \fBNote\fP .RS 4 When widget is not derived from \fBQwtLegendLabel\fP renderItem does nothing beside the background .RE .PP .PP Definition at line 727 of file qwt_legend\&.cpp\&. .SS "void QwtLegend::renderLegend (QPainter * painter, const QRectF & rect, bool fillBackground) const\fC [override]\fP, \fC [virtual]\fP" Render the legend into a given rectangle\&. .PP \fBParameters\fP .RS 4 \fIpainter\fP Painter .br \fIrect\fP Bounding rectangle .br \fIfillBackground\fP When true, fill rect with the widget background .RE .PP \fBSee also\fP .RS 4 \fBrenderLegend()\fP is used by \fBQwtPlotRenderer\fP - not by \fBQwtLegend\fP itself .RE .PP .PP Implements \fBQwtAbstractLegend\fP\&. .PP Definition at line 665 of file qwt_legend\&.cpp\&. .SS "int QwtLegend::scrollExtent (Qt::Orientation orientation) const\fC [override]\fP, \fC [virtual]\fP" Return the extent, that is needed for the scrollbars .PP \fBParameters\fP .RS 4 \fIorientation\fP Orientation .RE .PP \fBReturns\fP .RS 4 The width of the vertical scrollbar for Qt::Horizontal and v\&.v\&. .RE .PP .PP Reimplemented from \fBQwtAbstractLegend\fP\&. .PP Definition at line 821 of file qwt_legend\&.cpp\&. .SS "void QwtLegend::setDefaultItemMode (\fBQwtLegendData::Mode\fP mode)" .PP Set the default mode for legend labels\&. Legend labels will be constructed according to the attributes in a \fBQwtLegendData\fP object\&. When it doesn't contain a value for the QwtLegendData::ModeRole the label will be initialized with the default mode of the legend\&. .PP \fBParameters\fP .RS 4 \fImode\fP Default item mode .RE .PP \fBSee also\fP .RS 4 itemMode(), \fBQwtLegendData::value()\fP, \fBQwtPlotItem::legendData()\fP .RE .PP \fBNote\fP .RS 4 Changing the mode doesn't have any effect on existing labels\&. .RE .PP .PP Definition at line 335 of file qwt_legend\&.cpp\&. .SS "void QwtLegend::setMaxColumns (uint numColums)" .PP 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 .PP \fBParameters\fP .RS 4 \fInumColums\fP Maximum number of entries in a row .RE .PP \fBSee also\fP .RS 4 \fBmaxColumns()\fP, \fBQwtDynGridLayout::setMaxColumns()\fP .RE .PP .PP Definition at line 296 of file qwt_legend\&.cpp\&. .SS "void QwtLegend::updateLegend (const QVariant & itemInfo, const \fBQList\fP< \fBQwtLegendData\fP > & legendData)\fC [override]\fP, \fC [virtual]\fP, \fC [slot]\fP" .PP Update the entries for an item\&. .PP \fBParameters\fP .RS 4 \fIitemInfo\fP Info for an item .br \fIlegendData\fP List of legend entry attributes for the item .RE .PP .PP Definition at line 396 of file qwt_legend\&.cpp\&. .SS "void QwtLegend::updateWidget (QWidget * widget, const \fBQwtLegendData\fP & legendData)\fC [protected]\fP, \fC [virtual]\fP" .PP Update the widget\&. .PP \fBParameters\fP .RS 4 \fIwidget\fP Usually a \fBQwtLegendLabel\fP .br \fIlegendData\fP Attributes to be displayed .RE .PP \fBSee also\fP .RS 4 \fBcreateWidget()\fP .RE .PP \fBNote\fP .RS 4 When widget is no \fBQwtLegendLabel\fP \fBupdateWidget()\fP does nothing\&. .RE .PP .PP Definition at line 489 of file qwt_legend\&.cpp\&. .SS "QScrollBar * QwtLegend::verticalScrollBar () const" .PP \fBReturns\fP .RS 4 Vertical scrollbar .RE .PP \fBSee also\fP .RS 4 \fBhorizontalScrollBar()\fP .RE .PP .PP Definition at line 373 of file qwt_legend\&.cpp\&. .SH "Author" .PP Generated automatically by Doxygen for Qwt User's Guide from the source code\&.