4 #include <QGraphicsView>
7 #include "data/graph.h"
19 class QGraphicsSimpleTextItem
;
21 class GraphView
: public QGraphicsView
26 GraphView(QWidget
*parent
= 0);
29 bool isEmpty() const {return _graphs
.isEmpty();}
30 const QList
<KV
> &info() const {return _info
->info();}
33 void plot(QPainter
*painter
, const QRectF
&target
, qreal scale
);
35 void setPalette(const Palette
&palette
);
36 void setGraphWidth(int width
);
37 void showGrid(bool show
);
38 void showSliderInfo(bool show
);
39 void useOpenGL(bool use
);
40 void useAntiAliasing(bool use
);
42 void setSliderPosition(qreal pos
);
43 void setSliderColor(const QColor
&color
);
46 void sliderPositionChanged(qreal
);
49 void addGraph(GraphItem
*graph
, int id
= 0);
51 void showGraph(bool show
, int id
= 0);
52 void setGraphType(GraphType type
);
53 void setUnits(Units units
);
55 const QString
&yLabel() const {return _yLabel
;}
56 const QString
&yUnits() const {return _yUnits
;}
57 qreal
yScale() const {return _yScale
;}
58 qreal
yOffset() const {return _yOffset
;}
59 void setYLabel(const QString
&label
);
60 void setYUnits(const QString
&units
);
61 void setYScale(qreal scale
) {_yScale
= scale
;}
62 void setYOffset(qreal offset
) {_yOffset
= offset
;}
64 void setSliderPrecision(int precision
) {_precision
= precision
;}
65 void setMinYRange(qreal range
) {_minYRange
= range
;}
67 QRectF
bounds() const;
69 void addInfo(const QString
&key
, const QString
&value
);
71 void skipColor() {_palette
.nextColor();}
73 void changeEvent(QEvent
*e
);
75 QList
<GraphItem
*> _graphs
;
79 void emitSliderPositionChanged(const QPointF
&pos
);
80 void newSliderPosition(const QPointF
&pos
);
83 void redraw(const QSizeF
&size
);
87 void updateSliderPosition();
88 void updateSliderInfo();
89 void removeItem(QGraphicsItem
*item
);
90 void addItem(QGraphicsItem
*item
);
92 void resizeEvent(QResizeEvent
*e
);
93 void mousePressEvent(QMouseEvent
*e
);
96 qreal _xScale
, _yScale
;
98 QString _xUnits
, _yUnits
;
99 QString _xLabel
, _yLabel
;
104 QGraphicsScene
*_scene
;
106 AxisItem
*_xAxis
, *_yAxis
;
108 SliderInfoItem
*_sliderInfo
;
111 QGraphicsSimpleTextItem
*_message
;
113 QList
<GraphItem
*> _visible
;
120 #endif // GRAPHVIEW_H