QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
Public 类型 | Public 成员函数 | 所有成员列表
QwtLegendData类 参考

Attributes of an entry on a legend 更多...

#include <qwt_legend_data.h>

Public 类型

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

Public 成员函数

 QwtLegendData ()
 Constructor
 
 QwtLegendData (const QwtLegendData &)
 Copy constructor
 
 QwtLegendData (QwtLegendData &&) noexcept=default
 
 ~QwtLegendData ()
 Destructor
 
QwtLegendDataoperator= (const QwtLegendData &)
 Copy assignment
 
QwtLegendDataoperator= (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.

参见
QwtLegend, QwtPlotLegendItem
注解
The stockchart example implements a legend as a tree with checkable items

成员枚举类型说明

◆ Mode

Mode defining how a legend entry interacts

枚举值
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

枚举值
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

参数
roleAttribute role
返回
True, when the internal map has an entry for role
参见
setValue(), value()

◆ icon()

QwtGraphic QwtLegendData::icon ( ) const

Return the icon

返回
Value of the IconRole attribute
参见
title(), mode()

◆ isValid()

bool QwtLegendData::isValid ( ) const

Check if the legend data is valid

返回
True, when the internal map is empty
参见
setValues(), setValue()

◆ mode()

QwtLegendData::Mode QwtLegendData::mode ( ) const

Return the mode

返回
Value of the ModeRole attribute
ReadOnly when no mode is set
参见
title(), icon()

◆ setValue()

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

Set an attribute value

参数
roleAttribute role
dataAttribute value
参见
value()

◆ setValues()

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

Set the legend attributes

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

参数
mapValues
参见
values()

◆ title()

QwtText QwtLegendData::title ( ) const

Return the title

返回
Value of the TitleRole attribute
参见
icon(), mode()

◆ value()

QVariant QwtLegendData::value ( int  role) const

Return the attribute value for a specific role

参数
roleAttribute role
返回
Attribute value for a specific role
参见
setValue()

◆ values()

const QMap< int, QVariant > & QwtLegendData::values ( ) const

Return the legend attributes

返回
Legend attributes
参见
setValues()

该类的文档由以下文件生成: