QwtLegend(3)
πΈ NAME πΈ
okay bestie, you found the QwtLegend(3) page from the Library Functions Manual β welcome to the legend widget era. QwtLegend - The legend widget. π
β¨
β¨ SYNOPSIS β¨
Include it like this, exactly:
#include <qwt_legend.h>
It inherits QwtAbstractLegend. π«Ά
π Public Slots π
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.
π Signals π
void clicked (const QVariant &itemInfo, int index)void checked (const QVariant &itemInfo, bool on, int index)
No descriptions on these signal lines in the page β just the declarations. π‘
π¦ Public Member Functions π¦
QwtLegend (QWidget *parent=NULL)virtual ~QwtLegend ()β Destructor.void setMaxColumns (uint numColums)β Set the maximum number of entries in a row.uint maxColumns () constvoid setDefaultItemMode (QwtLegendData::Mode)β Set the default mode for legend labels.QwtLegendData::Mode defaultItemMode () constQWidget * contentsWidget ()const QWidget * contentsWidget () constQWidget * legendWidget (const QVariant &) constQList< QWidget * > legendWidgets (const QVariant &) constQVariant itemInfo (const QWidget *) constvirtual bool eventFilter (QObject *, QEvent *) overridevirtual QSize sizeHint () const overrideβ Return a size hint.virtual int heightForWidth (int w) const overrideQScrollBar * horizontalScrollBar () constQScrollBar * verticalScrollBar () constvirtual void renderLegend (QPainter *, const QRectF &, bool fillBackground) const overridevirtual void renderItem (QPainter *, const QWidget *, const QRectF &, bool fillBackground) constvirtual bool isEmpty () const overridevirtual int scrollExtent (Qt::Orientation) const override
π Public Member Functions inherited from QwtAbstractLegend π
QwtAbstractLegend (QWidget *parent=NULL)virtual ~QwtAbstractLegend ()β Destructor.
π Protected Slots π
void itemClicked ()void itemChecked (bool)
π Protected Member Functions π
virtual QWidget * createWidget (const QwtLegendData &) constβ Create a widget to be inserted into the legend.virtual void updateWidget (QWidget *, const QwtLegendData &)β Update the widget.
π 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 π
QwtLegendLabelQwtPlotItemQwtPlot
Definition at line 31 of file qwt_legend.h. π
π§ Constructor & Destructor Documentation π§
π QwtLegend::QwtLegend (QWidget * parent = NULL) [explicit] π
Constructor. π οΈ
Parameters
parentβ Parent widget
Definition at line 258 of file qwt_legend.cpp. π
π QwtLegend::~QwtLegend () [virtual] π
Destructor. π
Definition at line 281 of file qwt_legend.cpp. π
π Member Function Documentation π
okay bestie, deep breath β this is the full roster, every single member function, no skips, no "you can read the rest yourself" energy. π«Ά Some of these are signals, some are protected hooks you can override, some are just lil getters. All of them matter. Let's go. β¨
πΈ void QwtLegend::checked (const QVariant & itemInfo, bool on, int index) β [signal] πΈ
This is the signal that fires when the user clicks a legend label that's living in QwtLegendData::Checkable mode. It's literally announcing "bestie checked a box" π
Parameters
itemInfoβ info for the item of the selected legend labelindexβ index of the legend label in the list of widgets that are associated with the plot itemonβtruewhen the legend label is checked
Note: clicks are disabled as default π
See also: setDefaultItemMode(), defaultItemMode(), QwtPlot::itemToInfo()
π¦ void QwtLegend::clicked (const QVariant & itemInfo, int index) β [signal] π¦
The other signal, the tap-happy one: it's emitted when the user has clicked on a legend label that's sitting in QwtLegendData::Clickable mode. Same vibe, different mode. π
Parameters
itemInfoβ info for the item item of the selected legend itemindexβ 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()
π QWidget * QwtLegend::contentsWidget () π
Okay so picture this: the contents widget is the only child of the viewport of the internal QScrollArea, and it's also the parent widget of all the legend items. It's giving main character energy, holding everything together. π
Returns: container widget of the legend items
Definition at line 355 of file qwt_legend.cpp.
π const QWidget * QwtLegend::contentsWidget () const π
Same iconic widget as above, just the const version β and yep, same story: it's the only child of the viewport of the internal QScrollArea and the parent of all the legend items. π«Ά
Returns: container widget of the legend items
Definition at line 385 of file qwt_legend.cpp.
β¨ QWidget * QwtLegend::createWidget (const QwtLegendData & legendData) const β [protected], [virtual] β¨
This is the "make me a widget to put in the legend" function. The default implementation just returns a QwtLegendLabel β simple, effective, slay. π
Parameters
legendDataβ attributes of the legend entry
Returns: widget representing data on the legend
Note:updateWidget()will called soon aftercreateWidget()with the same attributes.
Definition at line 467 of file qwt_legend.cpp.
π QwtLegendData::Mode QwtLegend::defaultItemMode () const π
Returns: default item mode
See also: setDefaultItemMode()
Definition at line 344 of file qwt_legend.cpp.
π§ bool QwtLegend::eventFilter (QObject * object, QEvent * event) β [override], [virtual] π§
This one handles the QEvent::ChildRemoved and QEvent::LayoutRequest events for the contentsWidget(). Somebody's gotta keep the group chat in order. π
Parameters
objectβ object to be filteredeventβ event
Returns: forwarded to QwtAbstractLegend::eventFilter()
Definition at line 559 of file qwt_legend.cpp.
πΊ int QwtLegend::heightForWidth (int width) const β [override], [virtual] πΊ
Returns: the preferred height, for a width.
Parameters
widthβ width
Definition at line 538 of file qwt_legend.cpp.
β QScrollBar * QwtLegend::horizontalScrollBar () const β
Returns: horizontal scrollbar
See also: verticalScrollBar()
Definition at line 364 of file qwt_legend.cpp.
π bool QwtLegend::isEmpty () const β [override], [virtual] π
Returns: true, when no item is inserted
Implements QwtAbstractLegend.
Definition at line 810 of file qwt_legend.cpp.
π void QwtLegend::itemChecked (bool on) β [protected], [slot] π
Called internally when the legend has been checked. Emits a checked() signal. That's the whole job bestie. π«‘
Definition at line 638 of file qwt_legend.cpp.
π void QwtLegend::itemClicked () β [protected], [slot] π
Called internally when the legend has been clicked on. Emits a clicked() signal. Yes that's literally it. π
Definition at line 616 of file qwt_legend.cpp.
π₯ QVariant QwtLegend::itemInfo (const QWidget * widget) const π₯
Finds the item that's associated with a widget. Detective mode: activated. π΅οΈββοΈ
Parameters
widgetβ widget on the legend
Returns: associated item info
See also: legendWidget()
Definition at line 804 of file qwt_legend.cpp.
π 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.
π¦ QList< QWidget * > QwtLegend::legendWidgets (const QVariant & itemInfo) const π¦
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.
πΈ 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.
β¨ void QwtLegend::renderItem (QPainter * painter, const QWidget * widget, const QRectF & rect, bool fillBackground) const β [virtual] β¨
Renders a single legend entry into a given rectangle. It's giving arts and crafts hour. π¨
Parameters
painterβ painterwidgetβ widget representing a legend entryrectβ bounding rectanglefillBackgroundβ whentrue, fillrectwith the widget background
Note: whenwidgetis not derived fromQwtLegendLabel,renderItemdoes nothing beside the background
Definition at line 727 of file qwt_legend.cpp.
π void QwtLegend::renderLegend (QPainter * painter, const QRectF & rect, bool fillBackground) const β [override], [virtual] π
Renders the whole legend into a given rectangle β the group photo of functions. πΈ
Parameters
painterβ painterrectβ bounding rectanglefillBackgroundβ whentrue, fillrectwith 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.
π§ int QwtLegend::scrollExtent (Qt::Orientation orientation) const β [override], [virtual] π§
Returns the extent, that is needed for the scrollbars. Lowkey very specific but okay. π
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.
π void QwtLegend::setDefaultItemMode (QwtLegendData::Mode mode) π
Sets the default mode for legend labels. Here's the tea: legend labels get constructed according to the attributes in a QwtLegendData object, and when that object doesn't contain a value for the QwtLegendData::ModeRole, the label gets initialized with the legend's default mode. β¨
Parameters
modeβ default item mode
See also: itemMode(), QwtLegendData::value(), QwtPlotItem::legendData()
Note: changing the mode doesn't have any effect on existing labels. New labels only, no take-backs. π
Definition at line 335 of file qwt_legend.cpp.
πΊ void QwtLegend::setMaxColumns (uint numColums) πΊ
Sets 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.
β QSize QwtLegend::sizeHint () const β [override], [virtual] β
Returns a size hint. Short and sweet, we love a minimal queen. π
Definition at line 526 of file qwt_legend.cpp.
π void QwtLegend::updateLegend (const QVariant & itemInfo, const QList< QwtLegendData > & legendData) β [override], [virtual], [slot] π
Updates the entries for an item. Glow-up time for the legend. π
Parameters
itemInfoβ info for an itemlegendDataβ list of legend entry attributes for the item
Definition at line 396 of file qwt_legend.cpp.
π void QwtLegend::updateWidget (QWidget * widget, const QwtLegendData & legendData) β [protected], [virtual] π
Updates the widget. The little sibling of createWidget(). π«Ά
Parameters
widgetβ usually aQwtLegendLabellegendDataβ attributes to be displayed
See also: createWidget()
Note: whenwidgetis noQwtLegendLabel,updateWidget()does nothing.
Definition at line 489 of file qwt_legend.cpp.
π QScrollBar * QwtLegend::verticalScrollBar () const π
Returns: vertical scrollbar
See also: horizontalScrollBar()
Definition at line 373 of file qwt_legend.cpp.
π Author π
Generated automatically by Doxygen for Qwt User's Guide from the source code. Not me hand-typing it, the robots did that part. π€π
okay that's the whole page bestie, you made it to the end, I'm so proud of you π₯Ήπ This edition is from the Qwt User's Guide, the QwtLegend(3) page, and it's auto-generated by Doxygen straight from the source code β so if anything here looks off, blame the source, not me. periodt. π
β¨
π¦ where this page comes from
- alpine 3.24: qwt-doc 6.3.0-r0 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms