-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathcontrol_dot.h
40 lines (27 loc) · 988 Bytes
/
control_dot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef CONTROL_DOT_H
#define CONTROL_DOT_H
#include <QPainter>
#include <QGraphicsItem>
#include "slice_diagram.h"
class SliceDiagram;
#include "slice_line.h"
class SliceLine;
class ControlDot : public QGraphicsItem
{
public:
ControlDot(SliceLine* line, bool left_bottom);
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void set_position(const QPointF &newpos);
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
private:
SliceLine* slice_line;
QGraphicsTextItem* coords;
bool pressed;
bool left_bottom; //TRUE if this is a left-bottom control dot, FALSE if this is a right-top control dot
bool update_lock; //TRUE when the dot is being moved as result of external input; to avoid update loops
};
#endif // CONTROL_DOT_H