|
QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
|
The legend widget 更多...
#include <qwt_legend.h>
类 | |
| class | PrivateData |
Public 槽 | |
| virtual void | updateLegend (const QVariant &, const QList< QwtLegendData > &) override |
| Update the entries for an item | |
Public 槽 继承自 QwtAbstractLegend | |
| virtual void | updateLegend (const QVariant &itemInfo, const QList< QwtLegendData > &data)=0 |
信号 | |
| void | clicked (const QVariant &itemInfo, int index) |
| Signal emitted when the user clicks on a legend label in Clickable mode | |
| void | checked (const QVariant &itemInfo, bool on, int index) |
| Signal emitted when the user clicks on a legend label in Checkable mode | |
Public 成员函数 | |
| QwtLegend (QWidget *parent=nullptr) | |
| Constructor for QwtLegend | |
| void | setMaxColumns (uint numColums) |
| Set the maximum number of entries in a row | |
| uint | maxColumns () const |
| Return the maximum number of entries in a row | |
| void | setDefaultItemMode (QwtLegendData::Mode) |
| Set the default mode for legend labels | |
| QwtLegendData::Mode | defaultItemMode () const |
| Return the default item mode | |
| QWidget * | contentsWidget () |
| Return the contents widget | |
| const QWidget * | contentsWidget () const |
| Return the contents widget (const version) | |
| QWidget * | legendWidget (const QVariant &) const |
| Return first widget in the list of widgets associated to an item | |
| QList< QWidget * > | legendWidgets (const QVariant &) const |
| Return list of widgets associated to an item | |
| QVariant | itemInfo (const QWidget *) const |
| Find the item that is associated to a widget | |
| virtual bool | eventFilter (QObject *, QEvent *) override |
| Handle QEvent::ChildRemoved and QEvent::LayoutRequest events | |
| virtual QSize | sizeHint () const override |
| Return a size hint | |
| virtual int | heightForWidth (int w) const override |
| Return the preferred height for a given width | |
| QScrollBar * | horizontalScrollBar () const |
| Return the horizontal scrollbar | |
| QScrollBar * | verticalScrollBar () const |
| Return the vertical scrollbar | |
| virtual void | renderLegend (QPainter *, const QRectF &, bool fillBackground) const override |
| Render the legend into a given rectangle | |
| virtual void | renderItem (QPainter *, const QWidget *, const QRectF &, bool fillBackground) const |
| Render a legend entry into a given rectangle | |
| virtual bool | isEmpty () const override |
| Check if the legend is empty | |
| virtual int | scrollExtent (Qt::Orientation) const override |
| Return the extent that is needed for the scrollbars | |
Public 成员函数 继承自 QwtAbstractLegend | |
| QwtAbstractLegend (QWidget *parent=nullptr) | |
| Constructor for QwtAbstractLegend | |
| ~QwtAbstractLegend () override | |
| Destructor for QwtAbstractLegend | |
Protected 槽 | |
| void | itemClicked () |
| Called internally when the legend has been clicked on | |
| void | itemChecked (bool) |
| Called internally when the legend has been checked | |
Protected 成员函数 | |
| 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.
|
explicit |
|
signal |
Signal emitted when the user clicks on a legend label in Checkable mode
| itemInfo | Info for the item of the selected legend label |
| on | True when the legend label is checked |
| index | Index of the legend label in the list of widgets associated with the plot item |
|
signal |
Signal emitted when the user clicks on a legend label in Clickable mode
| itemInfo | Info for the item of the selected legend item |
| index | Index of the legend label in the list of widgets associated with the plot item |
| QWidget * QwtLegend::contentsWidget | ( | ) |
Return the contents widget
The contents widget is the only child of the viewport of the internal QScrollArea and the parent widget of all legend items.
| const QWidget * QwtLegend::contentsWidget | ( | ) | const |
Return the contents widget (const version)
The contents widget is the only child of the viewport of the internal QScrollArea and the parent widget of all legend items.
|
protectedvirtual |
Create a widget to be inserted into the legend
The default implementation returns a QwtLegendLabel.
| legendData | Attributes of the legend entry |
| QwtLegendData::Mode QwtLegend::defaultItemMode | ( | ) | const |
|
overridevirtual |
Handle QEvent::ChildRemoved and QEvent::LayoutRequest events
Handle QEvent::ChildRemoved and QEvent::LayoutRequest events for the contentsWidget().
| object | Object to be filtered |
| event | Event |
|
overridevirtual |
| QScrollBar * QwtLegend::horizontalScrollBar | ( | ) | const |
|
overridevirtual |
|
protectedslot |
Called internally when the legend has been checked
Emits a checked() signal.
|
protectedslot |
Called internally when the legend has been clicked on
Emits a clicked() signal.
| QVariant QwtLegend::itemInfo | ( | const QWidget * | widget | ) | const |
Find the item that is associated to a widget
| widget | Widget on the legend |
| QWidget * QwtLegend::legendWidget | ( | const QVariant & | itemInfo | ) | const |
Return first widget in the list of widgets associated to an item
| itemInfo | Info about an item |
| QList< QWidget * > QwtLegend::legendWidgets | ( | const QVariant & | itemInfo | ) | const |
Return list of widgets associated to an item
| itemInfo | Info about an item |
| uint QwtLegend::maxColumns | ( | ) | const |
Return the maximum number of entries in a row
|
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 |
|
overridevirtual |
Render the legend into a given rectangle
| painter | Painter |
| rect | Bounding rectangle |
| fillBackground | When true, fill rect with the widget background |
实现了 QwtAbstractLegend.
|
overridevirtual |
Return the extent that is needed for the scrollbars
| orientation | Orientation |
重载 QwtAbstractLegend .
| 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 |
| 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 |
|
overridevirtual |
|
overridevirtualslot |
Update the entries for an item
| itemInfo | Info for an item |
| legendData | List of legend entry attributes for the item |
|
protectedvirtual |
Update the widget
| widget | Usually a QwtLegendLabel |
| legendData | Attributes to be displayed |
| QScrollBar * QwtLegend::verticalScrollBar | ( | ) | const |