Human-friendly links
[GPXSee.git] / src / graphitem.h
blob967b1db2a05dbe9aa1d128039a4196bdc6873f4d
1 #ifndef GRAPHITEM_H
2 #define GRAPHITEM_H
4 #include <QGraphicsObject>
5 #include <QPen>
6 #include "graph.h"
8 class GraphItem : public QGraphicsObject
10 Q_OBJECT
12 public:
13 GraphItem(const Graph &graph, QGraphicsItem *parent = 0);
15 QRectF boundingRect() const
16 {return _path.boundingRect();}
17 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
18 QWidget *widget);
20 const QRectF &bounds() const {return _bounds;}
21 void setScale(qreal sx, qreal sy);
23 void setGraphType(GraphType type);
24 int id() const {return _id;}
25 void setId(int id) {_id = id;}
26 void setColor(const QColor &color);
27 void setWidth(int width);
29 qreal yAtX(qreal x);
30 qreal distanceAtTime(qreal time);
32 signals:
33 void sliderPositionChanged(qreal);
35 public slots:
36 void emitSliderPositionChanged(qreal);
37 void selected(bool selected);
39 private:
40 void updatePath();
41 void updateBounds();
43 int _id;
44 QPen _pen;
45 int _width;
47 Graph _graph;
48 GraphType _type;
50 QPainterPath _path;
51 QRectF _bounds;
52 qreal _sx, _sy;
55 #endif // GRAPHITEM_H