-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathline.h
53 lines (40 loc) · 1.16 KB
/
line.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
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef LINE_H
#define LINE_H
#include <QWidget>
#include <QPainter>
#include <QGraphicsSceneMouseEvent>
#include <QDebug>
#include <QPoint>
#include <Qt>
#include "item.h"
#include "apidrawer.h"
class Scene;
class Line : public Item
{
public:
Line(Scene *scene, QGraphicsItem *parent = nullptr);
Line(int x1, int y1, int x2, int y2, Scene *scene, QGraphicsItem *parent = nullptr);
Line(const QPoint &from, const QPoint &to, Scene *scene, QGraphicsItem *parent = nullptr);
Type getType() const override;
QColor getFillColor() const override;
QPoint getPoint1() const;
QPoint getPoint2() const;
void setPoint1(const QPoint &point);
void setPoint2(const QPoint &point);
int getX1() const;
void setX1(int value);
int getY1() const;
void setY1(int value);
int getX2() const;
void setX2(int value);
int getY2() const;
void setY2(int value);
void reDraw() override;
protected:
QRectF boundingRect() const override;
// void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
void drawLine();
private:
int x1, y1, x2, y2;
};
#endif // LINE_H