Public Types | Public Member Functions | Private Attributes
QwtLegendData Class Reference

Attributes of an entry on a legend. More...

#include <qwt_legend_data.h>

List of all members.

Public Types

enum  Mode { ReadOnly, Clickable, Checkable }
 Mode defining how a legend entry interacts. More...
enum  Role { ModeRole, TitleRole, IconRole, UserRole = 32 }
 Identifier how to interprete a QVariant. More...

Public Member Functions

bool hasRole (int role) const
QwtGraphic icon () const
bool isValid () const
Mode mode () const
 QwtLegendData ()
 Constructor.
void setValue (int role, const QVariant &)
void setValues (const QMap< int, QVariant > &)
QwtText title () const
QVariant value (int role) const
const QMap< int, QVariant > & values () const
 ~QwtLegendData ()
 Destructor.

Private Attributes

QMap< int, QVariant > d_map

Detailed Description

Attributes of an entry on a legend.

QwtLegendData is an abstract container ( like QAbstractModel ) to exchange attributes, that are only known between to 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

Definition at line 35 of file qwt_legend_data.h.


Member Enumeration Documentation

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.

Definition at line 39 of file qwt_legend_data.h.

Identifier how to interprete a QVariant.

Enumerator:
ModeRole 
TitleRole 
IconRole 
UserRole 

Definition at line 52 of file qwt_legend_data.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 13 of file qwt_legend_data.cpp.

Destructor.

Definition at line 18 of file qwt_legend_data.cpp.


Member Function Documentation

bool QwtLegendData::hasRole ( int  role) const
Parameters:
roleAttribute role
Returns:
True, when the internal map has an entry for role

Definition at line 49 of file qwt_legend_data.cpp.

Returns:
Value of the IconRole attribute

Definition at line 104 of file qwt_legend_data.cpp.

bool QwtLegendData::isValid ( ) const
Returns:
True, when the internal map is empty

Definition at line 80 of file qwt_legend_data.cpp.

Returns:
Value of the ModeRole attribute

Definition at line 118 of file qwt_legend_data.cpp.

void QwtLegendData::setValue ( int  role,
const QVariant &  data 
)

Set an attribute value

Parameters:
roleAttribute role
dataAttribute value
See also:
value()

Definition at line 62 of file qwt_legend_data.cpp.

void QwtLegendData::setValues ( const QMap< int, QVariant > &  map)

Set the legend attributes

QwtLegendData actually is a QMap<int, QVariant> with some convenience interfaces

Parameters:
mapValues
See also:
values()

Definition at line 31 of file qwt_legend_data.cpp.

Returns:
Value of the TitleRole attribute

Definition at line 86 of file qwt_legend_data.cpp.

QVariant QwtLegendData::value ( int  role) const
Parameters:
roleAttribute role
Returns:
Attribute value for a specific role

Definition at line 71 of file qwt_legend_data.cpp.

const QMap< int, QVariant > & QwtLegendData::values ( ) const
Returns:
Legend attributes
See also:
setValues()

Definition at line 40 of file qwt_legend_data.cpp.


Member Data Documentation

QMap<int, QVariant> QwtLegendData::d_map [private]

Definition at line 84 of file qwt_legend_data.h.


The documentation for this class was generated from the following files:


plotjuggler
Author(s): Davide Faconti
autogenerated on Fri Sep 1 2017 02:41:57