4 #include <QGraphicsView>
6 #include "data/graph.h"
19 class QGraphicsSimpleTextItem
;
24 class GraphView
: public QGraphicsView
29 GraphView(QWidget
*parent
= 0);
32 bool isEmpty() const {return _graphs
.isEmpty();}
33 const QList
<KV
<QString
, QString
> > &info() const {return _info
->info();}
36 void plot(QPainter
*painter
, const QRectF
&target
, qreal scale
);
38 void setPalette(const Palette
&palette
);
39 void setGraphWidth(int width
);
40 void showGrid(bool show
);
41 void showSliderInfo(bool show
);
42 void useOpenGL(bool use
);
43 void useAntiAliasing(bool use
);
45 void setSliderPosition(qreal pos
);
46 void setSliderColor(const QColor
&color
);
48 qreal
sliderPosition() const {return _sliderPos
;}
51 void sliderPositionChanged(qreal
);
54 void addGraph(GraphItem
*graph
);
55 void removeGraph(GraphItem
*graph
);
56 void setGraphType(GraphType type
);
57 void setUnits(Units units
);
59 void resizeEvent(QResizeEvent
*e
);
60 void mousePressEvent(QMouseEvent
*e
);
61 void wheelEvent(QWheelEvent
*e
);
62 void changeEvent(QEvent
*e
);
63 void paintEvent(QPaintEvent
*e
);
64 bool event(QEvent
*event
);
66 const QString
&yLabel() const {return _yLabel
;}
67 const QString
&yUnits() const {return _yUnits
;}
68 qreal
yScale() const {return _yScale
;}
69 qreal
yOffset() const {return _yOffset
;}
70 void setYLabel(const QString
&label
);
71 void setYUnits(const QString
&units
);
72 void setYScale(qreal scale
) {_yScale
= scale
;}
73 void setYOffset(qreal offset
) {_yOffset
= offset
;}
75 void setSliderPrecision(int precision
) {_precision
= precision
;}
76 void setMinYRange(qreal range
) {_minYRange
= range
;}
78 QRectF
bounds() const;
80 void addInfo(const QString
&key
, const QString
&value
);
89 void emitSliderPositionChanged(const QPointF
&pos
);
90 void newSliderPosition(const QPointF
&pos
);
93 void redraw(const QSizeF
&size
);
95 void updateSliderPosition();
96 void updateSliderInfo();
97 void removeItem(QGraphicsItem
*item
);
98 void addItem(QGraphicsItem
*item
);
99 bool singleGraph() const;
100 bool gestureEvent(QGestureEvent
*event
);
101 void pinchGesture(QPinchGesture
*gesture
);
103 GraphicsScene
*_scene
;
105 AxisItem
*_xAxis
, *_yAxis
;
106 AxisLabelItem
*_xAxisLabel
, *_yAxisLabel
;
108 SliderInfoItem
*_sliderInfo
;
111 QGraphicsSimpleTextItem
*_message
;
112 QList
<GraphItem
*> _graphs
;
117 qreal _xScale
, _yScale
;
119 QString _xUnits
, _yUnits
;
120 QString _xLabel
, _yLabel
;
127 #endif // GRAPHVIEW_H