-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelementwidget.h
116 lines (86 loc) · 2.66 KB
/
elementwidget.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#ifndef ELEMENTWIDGET_H
#define ELEMENTWIDGET_H
#include "classes.h"
#include <QWidget>
#include <QMouseEvent>
#include <QTimer>
#include <QLineEdit>
class ElementWidget : public QWidget
{
Q_OBJECT
friend class WorkPanel;
protected:
bool moving;
int px, py;
int drawType;
Element * e;
QWidget *l;
public:
explicit ElementWidget(QWidget *parent = 0);
virtual void updateSize();
void setElement(Element*_e);
Element* element(){return e;}
virtual void paintEvent ( QPaintEvent * event );
void mouseDoubleClickEvent(QMouseEvent *);
QPoint getPointPos(int type, int n);
void setDrawType(int);
signals:
void doubleClicked(ElementWidget*);
void needCalculation(Element*);
public slots:
void changeDrawType();
};
class SendElementWidget : public ElementWidget{
Q_OBJECT
public:
explicit SendElementWidget(QWidget *parent = 0) : ElementWidget(parent){};
virtual void updateSize();
virtual void paintEvent ( QPaintEvent * event );
void mouseDoubleClickEvent(QMouseEvent *);
};
class ReceiveElementWidget : public ElementWidget{
Q_OBJECT
public:
explicit ReceiveElementWidget(QWidget *parent = 0) : ElementWidget(parent){};
virtual void updateSize();
virtual void paintEvent ( QPaintEvent * event );
};
class NumberSendElement8Widget : public ElementWidget{
Q_OBJECT
QLineEdit *lineEdit;
void recalc(QString s);
public:
explicit NumberSendElement8Widget(QWidget *parent = 0) : ElementWidget(parent){lineEdit = 0;};
virtual void updateSize();
virtual void paintEvent ( QPaintEvent * event );
void mouseDoubleClickEvent(QMouseEvent *);
public slots:
void numberChanged();
};
class IfElementWidget : public ElementWidget{
Q_OBJECT
QLineEdit *lineEdit;
QString text;
void recalc(QString s);
public:
explicit IfElementWidget(QWidget *parent = 0) : ElementWidget(parent){lineEdit = 0;text="";};
virtual void paintEvent ( QPaintEvent * event );
void mouseDoubleClickEvent(QMouseEvent *);
public slots:
void numberChanged();
};
class NumberRecieveElement8Widget : public ElementWidget{
Q_OBJECT
public:
explicit NumberRecieveElement8Widget(QWidget *parent = 0) : ElementWidget(parent){};
virtual void updateSize();
virtual void paintEvent ( QPaintEvent * event );
};
class SegmentElementWidget : public ElementWidget{
Q_OBJECT
public:
explicit SegmentElementWidget(QWidget *parent = 0) : ElementWidget(parent){};
virtual void updateSize();
virtual void paintEvent ( QPaintEvent * event );
};
#endif // ELEMENTWIDGET_H