Attributes of an entry on a legend.
More...
#include <qwt_legend_data.h>
|
|
| QwtLegendData () |
| | Constructor.
|
| |
|
| QwtLegendData (const QwtLegendData &) |
| | Copy constructor.
|
| |
|
| QwtLegendData (QwtLegendData &&) noexcept=default |
| |
|
| ~QwtLegendData () |
| | Destructor.
|
| |
|
QwtLegendData & | operator= (const QwtLegendData &) |
| | Copy assignment.
|
| |
|
QwtLegendData & | operator= (QwtLegendData &&) noexcept=default |
| |
| void | setValues (const QMap< int, QVariant > &) |
| | Set the legend attributes.
|
| |
| const QMap< int, QVariant > & | values () const |
| | Return the legend attributes.
|
| |
| void | setValue (int role, const QVariant &) |
| | Set an attribute value.
|
| |
| QVariant | value (int role) const |
| | Return the attribute value for a specific role.
|
| |
| bool | hasRole (int role) const |
| | Check if a value exists for a specific role.
|
| |
| bool | isValid () const |
| | Check if the legend data is valid.
|
| |
| QwtGraphic | icon () const |
| | Return the icon.
|
| |
| QwtText | title () const |
| | Return the title.
|
| |
| Mode | mode () const |
| | Return the mode.
|
| |
Attributes of an entry on a legend.
QwtLegendData is an abstract container (like QAbstractModel) to exchange attributes that are only known between the plot item and the legend. By overloading QwtPlotItem::legendData() any other set of attributes could be used that can be handled by a modified (or completely different) implementation of a legend.
- See also
- QwtLegend, QwtPlotLegendItem
- Note
- The stockchart example implements a legend as a tree with checkable items
◆ Mode
Mode defining how a legend entry interacts.
| Enumerator |
|---|
| ReadOnly | The legend item is not interactive, like a label.
|
| Clickable | The legend item is clickable, like a push button.
|
| Checkable | The legend item is checkable, like a checkable button.
|
◆ Role
Identifier how to interpret a QVariant.
| Enumerator |
|---|
| ModeRole | The value is a Mode.
|
| TitleRole | The value is a title.
|
| IconRole | The value is an icon.
|
| UserRole | Values < UserRole are reserved for internal use.
|
◆ hasRole()
| bool QwtLegendData::hasRole |
( |
int |
role | ) |
const |
Check if a value exists for a specific role.
- Parameters
-
- Returns
- True, when the internal map has an entry for role
- See also
- setValue(), value()
◆ icon()
Return the icon.
- Returns
- Value of the IconRole attribute
- See also
- title(), mode()
◆ isValid()
| bool QwtLegendData::isValid |
( |
| ) |
const |
Check if the legend data is valid.
- Returns
- True, when the internal map is empty
- See also
- setValues(), setValue()
◆ mode()
Return the mode.
- Returns
- Value of the ModeRole attribute
-
ReadOnly when no mode is set
- See also
- title(), icon()
◆ setValue()
| void QwtLegendData::setValue |
( |
int |
role, |
|
|
const QVariant & |
data |
|
) |
| |
Set an attribute value.
- Parameters
-
| role | Attribute role |
| data | Attribute value |
- See also
- value()
◆ setValues()
| void QwtLegendData::setValues |
( |
const QMap< int, QVariant > & |
map | ) |
|
◆ title()
| QwtText QwtLegendData::title |
( |
| ) |
const |
Return the title.
- Returns
- Value of the TitleRole attribute
- See also
- icon(), mode()
◆ value()
| QVariant QwtLegendData::value |
( |
int |
role | ) |
const |
Return the attribute value for a specific role.
- Parameters
-
- Returns
- Attribute value for a specific role
- See also
- setValue()
◆ values()
| const QMap< int, QVariant > & QwtLegendData::values |
( |
| ) |
const |
Return the legend attributes.
- Returns
- Legend attributes
- See also
- setValues()
The documentation for this class was generated from the following files:
- /home/runner/work/QWT/QWT/src/plot/qwt_legend_data.h
- /home/runner/work/QWT/QWT/src/plot/qwt_legend_data.cpp