Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
3rdparty
qwt
src
qwt_legend_data.cpp
Go to the documentation of this file.
1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2
* Qwt Widget Library
3
* Copyright (C) 1997 Josef Wilgen
4
* Copyright (C) 2002 Uwe Rathmann
5
*
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the Qwt License, Version 1.0
8
*****************************************************************************/
9
10
#include "
qwt_legend_data.h
"
11
#include "
qwt_text.h
"
12
#include "
qwt_graphic.h
"
13
15
QwtLegendData::QwtLegendData
()
16
{
17
}
18
20
QwtLegendData::~QwtLegendData
()
21
{
22
}
23
33
void
QwtLegendData::setValues
(
const
QMap<int, QVariant>
&map )
34
{
35
d_map
= map;
36
}
37
42
const
QMap<int, QVariant>
&
QwtLegendData::values
()
const
43
{
44
return
d_map
;
45
}
46
51
bool
QwtLegendData::hasRole
(
int
role )
const
52
{
53
return
d_map
.contains( role );
54
}
55
64
void
QwtLegendData::setValue
(
int
role,
const
QVariant &
data
)
65
{
66
d_map
[role] =
data
;
67
}
68
73
QVariant
QwtLegendData::value
(
int
role )
const
74
{
75
if
( !
d_map
.contains( role ) )
76
return
QVariant();
77
78
return
d_map
[role];
79
}
80
82
bool
QwtLegendData::isValid
()
const
83
{
84
return
!
d_map
.isEmpty();
85
}
86
88
QwtText
QwtLegendData::title
()
const
89
{
90
QwtText
text;
91
92
const
QVariant titleValue =
value
(
QwtLegendData::TitleRole
);
93
if
( titleValue.canConvert<
QwtText
>() )
94
{
95
text = qvariant_cast<
QwtText
>( titleValue );
96
}
97
else
if
( titleValue.canConvert<QString>() )
98
{
99
text.
setText
( qvariant_cast<QString>( titleValue ) );
100
}
101
102
return
text;
103
}
104
106
QwtGraphic
QwtLegendData::icon
()
const
107
{
108
const
QVariant iconValue =
value
(
QwtLegendData::IconRole
);
109
110
QwtGraphic
graphic;
111
if
( iconValue.canConvert<
QwtGraphic
>() )
112
{
113
graphic = qvariant_cast<
QwtGraphic
>( iconValue );
114
}
115
116
return
graphic;
117
}
118
120
QwtLegendData::Mode
QwtLegendData::mode
()
const
121
{
122
const
QVariant modeValue =
value
(
QwtLegendData::ModeRole
);
123
if
( modeValue.canConvert<
int
>() )
124
{
125
const
int
mode
= qvariant_cast<
int
>( modeValue );
126
return
static_cast<
QwtLegendData::Mode
>
(
mode
);
127
}
128
129
return
QwtLegendData::ReadOnly
;
130
}
131
QwtLegendData::ModeRole
Definition:
qwt_legend_data.h:56
QwtText::setText
void setText(const QString &, QwtText::TextFormat textFormat=AutoText)
Definition:
qwt_text.cpp:254
QwtLegendData::setValues
void setValues(const QMap< int, QVariant > &)
Definition:
qwt_legend_data.cpp:33
QwtLegendData::IconRole
Definition:
qwt_legend_data.h:62
QwtLegendData::ReadOnly
The legend item is not interactive, like a label.
Definition:
qwt_legend_data.h:43
QwtLegendData::d_map
QMap< int, QVariant > d_map
Definition:
qwt_legend_data.h:85
QwtLegendData::hasRole
bool hasRole(int role) const
Definition:
qwt_legend_data.cpp:51
QwtLegendData::~QwtLegendData
~QwtLegendData()
Destructor.
Definition:
qwt_legend_data.cpp:20
QwtLegendData::QwtLegendData
QwtLegendData()
Constructor.
Definition:
qwt_legend_data.cpp:15
QwtText
A class representing a text.
Definition:
qwt_text.h:51
QwtLegendData::value
QVariant value(int role) const
Definition:
qwt_legend_data.cpp:73
QwtLegendData::icon
QwtGraphic icon() const
Definition:
qwt_legend_data.cpp:106
QwtGraphic
A paint device for scalable graphics.
Definition:
qwt_graphic.h:75
QwtLegendData::TitleRole
Definition:
qwt_legend_data.h:59
QwtLegendData::mode
Mode mode() const
Definition:
qwt_legend_data.cpp:120
QwtLegendData::title
QwtText title() const
Definition:
qwt_legend_data.cpp:88
QwtLegendData::values
const QMap< int, QVariant > & values() const
Definition:
qwt_legend_data.cpp:42
qwt_legend_data.h
QwtLegendData::setValue
void setValue(int role, const QVariant &)
Definition:
qwt_legend_data.cpp:64
qwt_text.h
QwtLegendData::isValid
bool isValid() const
Definition:
qwt_legend_data.cpp:82
mqtt_test.data
dictionary data
Definition:
mqtt_test.py:22
QwtLegendData::Mode
Mode
Mode defining how a legend entry interacts.
Definition:
qwt_legend_data.h:40
qwt_graphic.h
QMap< int, QVariant >
plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10