LegendWidget.h
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 private:
00074 PlotCurve* getCurve(const QString& s, int &point);
00075 void drawVector(PlotCurve *c, QPainter *p, int x, int y, int l);
00076 void drawSymbol(PlotCurve *c, int point, QPainter *p, int x, int y, int l);
00077 void drawText(QPainter *, const QRect&, QwtArray<long>, int);
00078
00079 QwtArray<long> itemsHeight(int symbolLineLength, int &width, int &height, int &textWidth, int &textHeight);
00080 int symbolsMaxWidth();
00081 QString parse(const QString& str);
00082
00083 virtual void paintEvent(QPaintEvent *e);
00084
00086 QwtText* d_text;
00088 int d_angle;
00090 int h_space;
00092 int left_margin, top_margin;
00094 int line_length;
00096 bool d_auto_update;
00097
00098 signals:
00099 void enableEditor();
00100 };
00101
00102 #endif