-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlock.hpp
55 lines (36 loc) · 1.19 KB
/
Block.hpp
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
#ifndef QNEBLOCK_H
#define QNEBLOCK_H
#include <QGraphicsPathItem>
#include "Pin.hpp"
#include "AComponent.hpp"
namespace nts {
class Port;
class Block : public QGraphicsPathItem {
public:
enum {
Type = QGraphicsItem::UserType + 3
};
Block(QGraphicsItem *parent = 0);
Port *addPort(const QString &name, Pin* pin, bool isOutput, int flags = 0, int ptr = 0);
void addInputPort(const QString &name, Pin *pin);
void addOutputPort(const QString &name, Pin *pin);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
Port *getPortFromPin(const Pin *pin);
Port *getPortFromPinId(size_t index);
size_t getPinIdFromPin(Pin *pin);
Block *clone();
QVector<Port *> ports();
int type() const { return Type; }
AComponent *getAComponent();
void setAComponent(AComponent *component);
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
private:
int horzMargin;
int vertMargin;
int width;
int height;
AComponent *aComponent;
};
}
#endif // QNEBLOCK_H