-
Notifications
You must be signed in to change notification settings - Fork 0
/
connectionviewcontroller.h
130 lines (88 loc) · 3.75 KB
/
connectionviewcontroller.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef CONNECTIONVIEWCONTROLLER_H
#define CONNECTIONVIEWCONTROLLER_H
#include <QQuickItem>
#include "typehelper.h"
#include "nodeviewcontroller.h"
class ConnectionViewController : public QQuickItem
{
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(QString uniqueID READ uniqueID WRITE setUniqueID NOTIFY uniqueIDChanged)
Q_PROPERTY(TypeHelper::ValueType valueType READ valueType WRITE setValueType NOTIFY valueTypeChanged)
Q_PROPERTY(quint16 sourceIdx READ sourceIdx WRITE setSourceIdx NOTIFY sourceIdxChanged)
Q_PROPERTY(quint16 targetIdx READ targetIdx WRITE setTargetIdx NOTIFY targetIdxChanged)
Q_PROPERTY(NodeViewController* targetView READ targetView WRITE setTargetView NOTIFY targetViewChanged)
Q_PROPERTY(NodeViewController* sourceView READ sourceView WRITE setSourceView NOTIFY sourceViewChanged)
Q_PROPERTY(int targetYOffset READ targetYOffset WRITE setTargetYOffset NOTIFY targetYOffsetChanged)
Q_PROPERTY(int sourceYOffset READ sourceYOffset WRITE setSourceYOffset NOTIFY sourceYOffsetChanged)
Q_PROPERTY(bool targetYhigher READ targetYhigher WRITE setTargetYhigher NOTIFY targetYhigherChanged)
Q_PROPERTY(bool targetXhigher READ targetXhigher WRITE setTargetXhigher NOTIFY targetXhigherChanged)
Q_PROPERTY(int addMargins READ addMargins WRITE setAddMargins NOTIFY addMarginsChanged)
Q_PROPERTY(int ctlPointXoffset READ ctlPointXoffset WRITE setCtlPointXoffset NOTIFY ctlPointXoffsetChanged)
public:
ConnectionViewController();
const TypeHelper::ValueType &valueType() const;
void setValueType(const TypeHelper::ValueType &newValueType);
quint16 sourceIdx() const;
void setSourceIdx(quint16 newSourceIdx);
quint16 targetIdx() const;
void setTargetIdx(quint16 newTargetIdx);
NodeViewController *targetView() const;
void setTargetView(NodeViewController *newTargetView);
NodeViewController *sourceView() const;
void setSourceView(NodeViewController *newSourceView);
int targetYOffset() const;
void setTargetYOffset(int newTargetYOffset);
int sourceYOffset() const;
void setSourceYOffset(int newSourceYOffset);
bool targetYhigher() const;
void setTargetYhigher(bool newTargetYhigher);
const QString &uniqueID() const;
void setUniqueID(const QString &newUniqueID);
bool initialSetup(NodeViewController* sourceView, quint16 sIdx, NodeViewController* targetView, quint16 tIdx);
bool targetXhigher() const;
void setTargetXhigher(bool newTargetXhigher);
int addMargins() const;
void setAddMargins(int newAddMargins);
int ctlPointXoffset() const;
void setCtlPointXoffset(int newCtlPointXoffset);
public slots:
void targetPositionChanged();
void sourcePositionChanged();
void targetOffsetsChanged();
void sourceOffsetsChanged();
signals:
void valueTypeChanged();
void sourceIdxChanged();
void targetIdxChanged();
void targetViewChanged();
void sourceViewChanged();
void targetYOffsetChanged();
void sourceYOffsetChanged();
void targetYhigherChanged();
void uniqueIDChanged();
void targetXhigherChanged();
void addMarginsChanged();
void ctlPointXoffsetChanged();
private:
TypeHelper::ValueType m_valueType = TypeHelper::Undefined;
quint16 m_sourceIdx = 0;
quint16 m_targetIdx = 0;
NodeViewController *m_targetView;
NodeViewController *m_sourceView;
int m_targetYOffset = 0;
int m_sourceYOffset = 0;
void setPositionAndSize();
int targetY();
int targetX();
int sourceY();
int sourceX();
bool m_targetYhigher;
QString m_uniqueID;
int addYoff = 5; // half connector width
bool setSigSlotConnections();
bool m_targetXhigher;
int m_addMargins = 10;
int m_ctlPointXoffset = 35;
};
#endif // CONNECTIONVIEWCONTROLLER_H