Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef LEGENDWIDGET_H
00030 #define LEGENDWIDGET_H
00031
00032 #include "FrameWidget.h"
00033 #include "Graph.h"
00034
00035 #include <qwt_plot.h>
00036 #include <qwt_text.h>
00037
00038 #include <QWidget>
00039
00040 class PlotCurve;
00041
00042 class LegendWidget: public FrameWidget
00043 {
00044 Q_OBJECT
00045
00046 public:
00047 LegendWidget(Graph *);
00048 ~LegendWidget();
00049
00050 void clone(LegendWidget* t);
00051
00052 QString text(){return d_text->text();};
00053 void setText(const QString& s);
00054
00055 QColor textColor(){return d_text->color();};
00056 void setTextColor(const QColor& c);
00057
00058 QFont font(){return d_text->font();};
00059 void setFont(const QFont& font);
00060
00061 void showTextEditor();
00062 void print(QPainter *p, const QwtScaleMap map[QwtPlot::axisCnt]);
00063
00064 QString saveToString();
00065 static void restore(Graph *g, const QStringList& lst);
00066
00067 bool isAutoUpdateEnabled(){return d_auto_update;};
00068 void setAutoUpdate(bool on = true){d_auto_update = on;};
00069
00070 int angle(){return d_angle;};
00071 void setAngle(int angle);
00072
00073 QSize textSize(QPainter *p, const QwtText& text);
00074
00075 bool hasTeXOutput(){return d_tex_output;};
00076 void setTeXOutput(bool on = true){d_tex_output = on;};
00077
00078 private:
00079 PlotCurve* getCurve(const QString& s, int &point);
00080 void drawVector(PlotCurve *c, QPainter *p, int x, int y, int l);
00081 void drawSymbol(PlotCurve *c, int point, QPainter *p, int x, int y, int l);
00082 void drawText(QPainter *, const QRect&, QwtArray<long>, int);
00083
00084 QwtArray<long> itemsHeight(QPainter *p, int symbolLineLength, int &width, int &height, int &textWidth, int &textHeight);
00085 int symbolsMaxWidth();
00086 QString parse(const QString& str);
00087
00088 virtual void paintEvent(QPaintEvent *e);
00089
00091 QwtText* d_text;
00093 int d_angle;
00095 int h_space;
00097 int left_margin, top_margin;
00099 int line_length;
00101 bool d_auto_update;
00103 bool d_tex_output;
00104
00105 signals:
00106 void enableEditor();
00107 };
00108
00109 #endif