decorator.hh
Go to the documentation of this file.
1 #include <qcustomplot.h>
2 #include <qcpitemrichtext.hh>
3 
4 #include <QObject>
5 
6 void registerQCustomPlot ();
7 
10 class QCustomPlotDecorator : public QObject
11 {
12  Q_OBJECT
13  public Q_SLOTS:
16  QCustomPlot* new_QCustomPlot(QWidget* parent = 0)
17  {
18  return new QCustomPlot(parent);
19  }
20  void delete_QCustomPlot(QCustomPlot* o) //delete QCustomPlot object
21  {
22  delete o;
23  }
25  {
26  o->clearGraphs();
27  }
28 
30  {
31  return o->addGraph();
32  }
34  {
35  o->addPlottable(ap);
36  }
37 
38  QCPGraph* graph(QCustomPlot* o, int graphnum)
39  {
40  return o->graph(graphnum);
41  }
42  void rescaleAxes(QCustomPlot* o, bool v = true) //rescale axis automatically if data does not fit
43  {
44  o->rescaleAxes(v);
45  }
47  void setInteraction(QCustomPlot* o, int interaction, bool enabled = true)
48  {
49  o->setInteraction((QCP::Interaction)interaction, enabled);
50  }
51 
52  bool savePdf (QCustomPlot* o, const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0, const QString &pdfCreator=QString(), const QString &pdfTitle=QString())
53  {
54  return o->savePdf (fileName, noCosmeticPen, width, height, pdfCreator, pdfTitle);
55  }
56  bool savePng (QCustomPlot* o, const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
57  {
58  return o->savePng (fileName, width, height, scale, quality);
59  }
60  bool saveJpg (QCustomPlot* o, const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
61  {
62  return o->saveJpg (fileName, width, height, scale, quality);
63  }
64  bool saveBmp (QCustomPlot* o, const QString &fileName, int width=0, int height=0, double scale=1.0)
65  {
66  return o->saveBmp (fileName, width, height, scale);
67  }
68  bool saveRastered (QCustomPlot* o, const QString &fileName, int width, int height, double scale, const char *format, int quality=-1)
69  {
70  return o->saveRastered (fileName, width, height, scale, format, quality);
71  }
72 
73  QCPAxis* xAxis (QCustomPlot* o) { return o->xAxis ; }
74  QCPAxis* xAxis2 (QCustomPlot* o) { return o->xAxis2; }
75  QCPAxis* yAxis (QCustomPlot* o) { return o->yAxis ; }
76  QCPAxis* yAxis2 (QCustomPlot* o) { return o->yAxis2; }
77  QCPLegend* legend (QCustomPlot* o) { return o->legend; }
78  QCPAxisRect* axisRect (QCustomPlot* o, int index=0) { return o->axisRect(index); }
80 
85  int selectedParts(const QCPAxis* a)
86  {
87  return a->selectedParts();
88  }
89  void setLabel(QCPAxis* a, const QString text)
90  {
91  a->setLabel(text);
92  }
93  void setRange(QCPAxis* a, double position, double size)
94  {
95  a->setRange(position, size);
96  }
97  void setAutoTicks(QCPAxis* a, bool on)
98  {
99  a->setAutoSubTicks(on);
100  }
101  void setAutoTickLabels(QCPAxis* a, bool on)
102  {
103  a->setAutoTickLabels(on);
104  }
105  void setTickVector(QCPAxis* a, const QVector<double> &ticks)
106  {
107  a->setTickVector(ticks);
108  }
109  void setTickVectorLabels(QCPAxis* a, const QVector<QString> &labels)
110  {
111  a->setTickVectorLabels(labels);
112  }
113  void setTickLength(QCPAxis* a, int inside, int outside)
114  {
115  a->setTickLength(inside,outside);
116  }
117  void setSubTickLength(QCPAxis* a, int inside, int outside)
118  {
119  a->setSubTickLength(inside, outside);
120  }
121  double pixelToCoord(QCPAxis* a, double pixel)
122  {
123  return a->pixelToCoord(pixel);
124  }
126 
129  QCPGraph* new_QCPGraph (QCPAxis* key, QCPAxis* value) { return new QCPGraph (key, value); }
130  void delete_QCPGraph (QCPGraph* g) { delete g; }
131  void setData (QCPGraph* g, const QVector<double> &keys, const QVector<double> &values)
132  {
133  g->setData(keys,values);
134  }
135  void addData (QCPGraph* g, const QVector<double> &keys, const QVector<double> &values)
136  {
137  g->addData(keys,values);
138  }
139  void addData (QCPGraph* g, const double &key, const double &value)
140  {
141  g->addData(key,value);
142  }
143  void clearData (QCPGraph* o) { o->clearData (); }
145 
148  QCPCurve* new_QCPCurve (QCPAxis* key, QCPAxis* value) { return new QCPCurve (key, value); }
149  void delete_QCPCurve (QCPCurve* g) { delete g; }
150  void setData (QCPCurve* c, const QVector<double> &keys, const QVector<double> &values)
151  {
152  c->setData(keys,values);
153  }
154  void addData (QCPCurve* c, const QVector<double> &ts, const QVector<double> &keys, const QVector<double> &values)
155  {
156  c->addData(ts, keys,values);
157  }
158  void clearData (QCPCurve* o) { o->clearData (); }
160 
163  QCPBars* new_QCPBars (QCPAxis* key, QCPAxis* value) { return new QCPBars (key, value); }
164  void delete_QCPBars (QCPBars* g) { delete g; }
165  void setData (QCPBars* c, const QVector<double> &keys, const QVector<double> &values)
166  {
167  c->setData(keys,values);
168  }
169  void addData (QCPBars* c, const QVector<double> &keys, const QVector<double> &values)
170  {
171  c->addData(keys,values);
172  }
173  void clearData (QCPBars* o) { o->clearData (); }
175 
178  void rescaleAxes(QCPAbstractPlottable* ap, bool v = true)
179  {
180  ap->rescaleAxes(v);
181  }
183 
187 
190  void insertRow (QCPLayoutGrid* lg, int row) //insert row above graph
191  {
192  lg->insertRow(row);
193  }
194  void insertColumn (QCPLayoutGrid* lg, int column) //insert column above graph
195  {
196  lg->insertColumn(column);
197  }
198  void addElement (QCPLayoutGrid* lg, int row, int column, QCPLayoutElement *element) //add text to graph at row,column
199  {
200  lg->addElement(row,column,element);
201  }
203 
206  void setRangeZoomAxes (QCPAxisRect* ar, QCPAxis* horizontal, QCPAxis* vertical)
207  {
208  ar->setRangeZoomAxes (horizontal, vertical);
209  }
211 
214  void setType (QCPItemPosition* ip, int type) { return ip->setType((QCPItemPosition::PositionType)type); }
216  void setCoords (QCPItemPosition* ip, double k, double v) { return ip->setCoords (k, v); }
218 
221  QCPItemPosition* position (QCPAbstractItem* ai, QString p) { return ai->position(p); }
222  QCPItemAnchor * anchor (QCPAbstractItem* ai, QString a) { return ai->anchor (a); }
224 
227  QCPItemTracer* new_QCPItemTracer (QCustomPlot* parent) { return new QCPItemTracer (parent); }
228  void delete_QCPItemTracer (QCPItemTracer* it) { delete it; }
230 
234  void delete_QCPItemRichText (QCPItemRichText* it) { delete it; }
236 
239  QCPItemText* new_QCPItemText (QCustomPlot* parent) { return new QCPItemText (parent); }
240  void delete_QCPItemText (QCPItemText* it) { delete it; }
242 
245  QCPItemEllipse* new_QCPItemEllipse (QCustomPlot* parent) { return new QCPItemEllipse (parent); }
246  void delete_QCPItemEllipse (QCPItemEllipse* it) { delete it; }
248 };
void addData(QCPGraph *g, const double &key, const double &value)
Definition: decorator.hh:139
int clearGraphs()
QCPAxis * yAxis2(QCustomPlot *o)
Definition: decorator.hh:76
void delete_QCPItemText(QCPItemText *it)
Definition: decorator.hh:240
void setData(QCPDataMap *data, bool copy=false)
void clearData(QCPBars *o)
Definition: decorator.hh:173
Definition: qcustomplot.h:1540
void insertColumn(int newIndex)
void delete_QCustomPlot(QCustomPlot *o)
Definition: decorator.hh:20
void setAutoSubTicks(bool on)
Definition: qcustomplot.h:3421
bool setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false)
void setTickVectorLabels(const QVector< QString > &vec)
QCustomPlot * new_QCustomPlot(QWidget *parent=0)
Definition: decorator.hh:16
QCPGraph * addGraph(QCPAxis *keyAxis=0, QCPAxis *valueAxis=0)
void clearGraphs(QCustomPlot *o)
Definition: decorator.hh:24
void setLabel(const QString &str)
void clearData(QCPGraph *o)
Definition: decorator.hh:143
virtual void clearData()
void setTickLength(QCPAxis *a, int inside, int outside)
Definition: decorator.hh:113
void insertColumn(QCPLayoutGrid *lg, int column)
Definition: decorator.hh:194
void setAutoTicks(QCPAxis *a, bool on)
Definition: decorator.hh:97
void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical)
void setTickVector(const QVector< double > &vec)
void delete_QCPGraph(QCPGraph *g)
Definition: decorator.hh:130
bool saveBmp(const QString &fileName, int width=0, int height=0, double scale=1.0)
Q_SLOT void setRange(const QCPRange &range)
void delete_QCPItemTracer(QCPItemTracer *it)
Definition: decorator.hh:228
QCPItemAnchor * anchor(QCPAbstractItem *ai, QString a)
Definition: decorator.hh:222
bool savePng(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
void addData(const QCPBarDataMap &dataMap)
QCPItemAnchor * anchor(const QString &name) const
bool savePdf(QCustomPlot *o, const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0, const QString &pdfCreator=QString(), const QString &pdfTitle=QString())
Definition: decorator.hh:52
virtual void clearData()
bool addElement(int row, int column, QCPLayoutElement *element)
void rescaleAxes(QCPAbstractPlottable *ap, bool v=true)
Definition: decorator.hh:178
double pixelToCoord(double value) const
void clearData(QCPCurve *o)
Definition: decorator.hh:158
QCPAxisRect * axisRect(int index=0) const
void setSubTickLength(QCPAxis *a, int inside, int outside)
Definition: decorator.hh:117
QCPAxis * yAxis
Definition: qcustomplot.h:1819
QCPGraph * addGraph(QCustomPlot *o)
Definition: decorator.hh:29
void setCoords(QCPItemPosition *ip, double k, double v)
Definition: decorator.hh:216
void setType(QCPItemPosition *ip, int type)
Definition: decorator.hh:214
Definition: qcustomplot.h:3513
QCPGraph * new_QCPGraph(QCPAxis *key, QCPAxis *value)
Definition: decorator.hh:129
void setData(QCPGraph *g, const QVector< double > &keys, const QVector< double > &values)
Definition: decorator.hh:131
void setData(QCPCurve *c, const QVector< double > &keys, const QVector< double > &values)
Definition: decorator.hh:150
Definition: qcustomplot.h:1680
void delete_QCPItemRichText(QCPItemRichText *it)
Definition: decorator.hh:234
QCPAxisRect * axisRect(QCustomPlot *o, int index=0)
Definition: decorator.hh:78
QCPItemText * new_QCPItemText(QCustomPlot *parent)
Definition: decorator.hh:239
Definition: qcustomplot.h:2169
QCPAxis * yAxis(QCustomPlot *o)
Definition: decorator.hh:75
QCPAxis * yAxis2
Definition: qcustomplot.h:1819
void addData(const QCPCurveDataMap &dataMap)
Definition: qcustomplot.h:757
Definition: qcpitemrichtext.hh:7
Definition: qcustomplot.h:629
QCPItemRichText * new_QCPItemRichText(QCustomPlot *parent)
Definition: decorator.hh:233
Definition: qcustomplot.h:1972
QCPBars * new_QCPBars(QCPAxis *key, QCPAxis *value)
Definition: decorator.hh:163
void setType(PositionType type)
void addData(const QCPDataMap &dataMap)
void delete_QCPItemEllipse(QCPItemEllipse *it)
Definition: decorator.hh:246
void setData(QCPCurveDataMap *data, bool copy=false)
void setAutoTickLabels(QCPAxis *a, bool on)
Definition: decorator.hh:101
bool saveJpg(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
QCPGraph * graph(QCustomPlot *o, int graphnum)
Definition: decorator.hh:38
bool saveBmp(QCustomPlot *o, const QString &fileName, int width=0, int height=0, double scale=1.0)
Definition: decorator.hh:64
void registerQCustomPlot()
PositionType
Definition: qcustomplot.h:1549
void setLabel(QCPAxis *a, const QString text)
Definition: decorator.hh:89
void insertRow(QCPLayoutGrid *lg, int row)
Definition: decorator.hh:190
Definition: qcustomplot.h:2660
QCPLegend * legend
Definition: qcustomplot.h:1820
void setCoords(double key, double value)
bool setParentAnchor(QCPItemPosition *ip, QCPItemAnchor *a)
Definition: decorator.hh:215
void setInteraction(QCustomPlot *o, int interaction, bool enabled=true)
Definition: decorator.hh:47
QCPAxis * xAxis2
Definition: qcustomplot.h:1819
void setInteraction(const QCP::Interaction &interaction, bool enabled=true)
bool savePdf(const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0, const QString &pdfCreator=QString(), const QString &pdfTitle=QString())
void setAutoTickLabels(bool on)
Definition: qcustomplot.h:980
void setTickVector(QCPAxis *a, const QVector< double > &ticks)
Definition: decorator.hh:105
void rescaleAxes(bool onlyEnlarge=false) const
void setSubTickLength(int inside, int outside=0)
void setData(QCPBarDataMap *data, bool copy=false)
Definition: qcustomplot.h:3634
SelectableParts selectedParts() const
Definition: qcustomplot.h:1132
bool saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality=-1)
void setRangeZoomAxes(QCPAxisRect *ar, QCPAxis *horizontal, QCPAxis *vertical)
Definition: decorator.hh:206
void setRange(QCPAxis *a, double position, double size)
Definition: decorator.hh:93
QCPCurve * new_QCPCurve(QCPAxis *key, QCPAxis *value)
Definition: decorator.hh:148
void setTickVectorLabels(QCPAxis *a, const QVector< QString > &labels)
Definition: decorator.hh:109
bool saveJpg(QCustomPlot *o, const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
Definition: decorator.hh:60
QCPItemEllipse * new_QCPItemEllipse(QCustomPlot *parent)
Definition: decorator.hh:245
Definition: qcustomplot.h:1503
void addData(QCPGraph *g, const QVector< double > &keys, const QVector< double > &values)
Definition: decorator.hh:135
Definition: qcustomplot.h:1607
void rescaleAxes(QCustomPlot *o, bool v=true)
Definition: decorator.hh:42
QCPGraph * graph(int index) const
QCPItemTracer * new_QCPItemTracer(QCustomPlot *parent)
Definition: decorator.hh:227
Q_SLOT void rescaleAxes(bool onlyVisiblePlottables=false)
void addPlottable(QCustomPlot *o, QCPAbstractPlottable *ap)
Definition: decorator.hh:33
void setTickLength(int inside, int outside=0)
Definition: qcustomplot.h:2823
bool savePng(QCustomPlot *o, const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
Definition: decorator.hh:56
QCPItemPosition * position(QCPAbstractItem *ai, QString p)
Definition: decorator.hh:221
int selectedParts(const QCPAxis *a)
Definition: decorator.hh:85
void addElement(QCPLayoutGrid *lg, int row, int column, QCPLayoutElement *element)
Definition: decorator.hh:198
virtual void clearData()
QCPAxis * xAxis2(QCustomPlot *o)
Definition: decorator.hh:74
bool addPlottable(QCPAbstractPlottable *plottable)
bool saveRastered(QCustomPlot *o, const QString &fileName, int width, int height, double scale, const char *format, int quality=-1)
Definition: decorator.hh:68
Definition: qcustomplot.h:2490
QCPAxis * xAxis(QCustomPlot *o)
Definition: decorator.hh:73
Definition: decorator.hh:10
void insertRow(int newIndex)
Definition: qcustomplot.h:1388
QCPLegend * legend(QCustomPlot *o)
Definition: decorator.hh:77
void setData(QCPBars *c, const QVector< double > &keys, const QVector< double > &values)
Definition: decorator.hh:165
void delete_QCPCurve(QCPCurve *g)
Definition: decorator.hh:149
void delete_QCPBars(QCPBars *g)
Definition: decorator.hh:164
double pixelToCoord(QCPAxis *a, double pixel)
Definition: decorator.hh:121
void addData(QCPBars *c, const QVector< double > &keys, const QVector< double > &values)
Definition: decorator.hh:169
QCPAxis * xAxis
Definition: qcustomplot.h:1819
void addData(QCPCurve *c, const QVector< double > &ts, const QVector< double > &keys, const QVector< double > &values)
Definition: decorator.hh:154
Interaction
Definition: qcustomplot.h:155
QCPItemPosition * position(const QString &name) const