QtiPlot
0.9.8.2
Main Page
Related Pages
Classes
Files
File List
File Members
qtiplot
src
plot2D
LegendWidget.h
Go to the documentation of this file.
1
/***************************************************************************
2
File : LegendWidget.h
3
Project : QtiPlot
4
--------------------------------------------------------------------
5
Copyright : (C) 2007 by Ion Vasilief
6
Email (use @ for *) : ion_vasilief*yahoo.fr
7
Description : A 2D Plot Legend Widget
8
9
***************************************************************************/
10
11
/***************************************************************************
12
* *
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
17
* *
18
* This program is distributed in the hope that it will be useful, *
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21
* GNU General Public License for more details. *
22
* *
23
* You should have received a copy of the GNU General Public License *
24
* along with this program; if not, write to the Free Software *
25
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26
* Boston, MA 02110-1301 USA *
27
* *
28
***************************************************************************/
29
#ifndef LEGENDWIDGET_H
30
#define LEGENDWIDGET_H
31
32
#include "
FrameWidget.h
"
33
#include "
Graph.h
"
34
35
#include <qwt_plot.h>
36
#include <qwt_text.h>
37
38
#include <QWidget>
39
40
class
PlotCurve
;
41
42
class
LegendWidget
:
public
FrameWidget
43
{
44
Q_OBJECT
45
46
public
:
47
LegendWidget
(
Graph
*);
48
~LegendWidget
();
49
50
void
clone
(
LegendWidget
* t);
51
52
QString
text
(){
return
d_text
->text();};
53
void
setText
(
const
QString& s);
54
55
QColor
textColor
(){
return
d_text
->color();};
56
void
setTextColor
(
const
QColor& c);
57
58
QFont
font
(){
return
d_text
->font();};
59
void
setFont
(
const
QFont&
font
);
60
61
void
showTextEditor
();
62
void
print
(QPainter *p,
const
QwtScaleMap map[QwtPlot::axisCnt]);
63
64
QString
saveToString
();
65
static
void
restore
(
Graph
*g,
const
QStringList& lst);
66
67
bool
isAutoUpdateEnabled
(){
return
d_auto_update
;};
68
void
setAutoUpdate
(
bool
on =
true
){
d_auto_update
= on;};
69
70
int
angle
(){
return
d_angle
;};
71
void
setAngle
(
int
angle
);
72
73
QSize
textSize
(QPainter *p,
const
QwtText&
text
);
74
75
bool
hasTeXOutput
(){
return
d_tex_output
;};
76
void
setTeXOutput
(
bool
on =
true
){
d_tex_output
= on;};
77
78
private
:
79
PlotCurve
*
getCurve
(
const
QString& s,
int
&point);
80
void
drawVector
(
PlotCurve
*c, QPainter *p,
int
x,
int
y,
int
l);
81
void
drawSymbol
(
PlotCurve
*c,
int
point, QPainter *p,
int
x,
int
y,
int
l);
82
void
drawText
(QPainter *,
const
QRect&, QwtArray<long>,
int
);
83
84
QwtArray<long>
itemsHeight
(QPainter *p,
int
symbolLineLength,
int
frameWidth
,
int
&width,
int
&height,
int
&textWidth,
int
&textHeight);
85
int
symbolsMaxWidth
();
86
QString
parse
(
const
QString& str);
87
88
virtual
void
paintEvent
(QPaintEvent *e);
89
91
QwtText*
d_text
;
93
int
d_angle
;
95
int
h_space
;
97
int
left_margin
,
top_margin
;
99
int
line_length
;
101
bool
d_auto_update
;
103
bool
d_tex_output
;
104
105
signals:
106
void
enableEditor
();
107
};
108
109
#endif
Generated on Tue Feb 19 2013 11:59:22 for QtiPlot by
1.8.3.1