Visualization 2 - Lab Course
 All Classes Functions Enumerations Enumerator
TransferPoint.hpp
1 #ifndef TRANSFERPOINT_HPP_
2 #define TRANSFERPOINT_HPP_
3 
4 #include <QGraphicsItem>
5 #include <QGraphicsSceneMouseEvent>
6 
13 class TransferPoint : public QGraphicsItem
14 {
15 public:
22  TransferPoint(qreal relX, qreal relY, qreal sigma = 0.2);
23 
28  QRectF boundingRect() const;
29 
33  void updateScene();
37  void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
38 
43  void setFixed(bool fixed);
49  void setRelativePos(qreal x, qreal y);
54  qreal getRelativeX();
59  qreal getRelativeY();
64  qreal getSigma();
69  void setSigma(qreal sigma);
70 
75  void setColor(QColor _color);
79  void setColorFromDialog();
84  QColor getColor();
85 
86 protected:
91  void mousePressEvent(QGraphicsSceneMouseEvent *event);
95  void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
96 
97 private:
98  qreal relX;
99  qreal relY;
100  qreal sigma;
101  bool isFixed;
102  QColor color;
103 
109  void updatePosition(qreal x, qreal y);
110 };
111 
112 #endif /* TRANSFERPOINT_HPP_ */