Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
node.h
Go to the documentation of this file.
1
7
8#ifndef NODE_H
9#define NODE_H
10
11#include <QGraphicsScene>
12#include <QGraphicsSceneMouseEvent>
13#include <QPainter>
14#include <QStyleOption>
15
16#include "Network.h"
17#include "graphwidget.h"
18#include "symbol.h"
19#include "wire.h"
20
23class Node : public Symbol {
24public:
27 Node(GraphWidget* graphWidget);
28
32 Node(GraphWidget* graphWidget, struct NodeInfo);
33
35 ~Node() {}
36
39 void addWire(Wire* Wire) {
40 WireList << Wire;
41 Wire->adjust();
42 }
43
46 QList<Wire*> Wires() const { return WireList; }
47
48 enum { Type = UserType + 1 };
49 int type() const { return Type; }
50
53
54 QRectF boundingRect() const { return QRectF(-4, -4, 8, 8); }
55
58 QPainterPath shape() const;
59
64 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
65 QWidget* widget);
66
70 QPoint getPortLocation(int /*port_number*/) { return QPoint(0, 0); }
71
74 QString getID() { return ID; }
75
77 void show() { visible = true; }
78
80 void hide() { visible = false; }
81
82protected:
84 QVariant itemChange(GraphicsItemChange change, const QVariant& value);
85
87 void mousePressEvent(QGraphicsSceneMouseEvent *event) {
88 update();
89 QGraphicsItem::mousePressEvent(event);
90 }
91
93 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event){
94 update();
95 QGraphicsItem::mouseReleaseEvent(event);
96 }
97
98
99private:
100 QList<Wire*> WireList;
101 QPointF newPos;
102 GraphWidget* graph;
103 QString ID;
104 bool visible;
105};
106
107#endif
Abstract base class for network implementations.
Definition graphwidget.h:28
Wiring node information class.
Definition infoclasses.h:241
Wiring node for circuit connections.
Definition node.h:23
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Handle mouse release events.
Definition node.h:93
void hide()
Hide node.
Definition node.h:80
QRectF boundingRect() const
Get node bounding rectangle.
Definition node.h:54
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Paint node on scene.
Definition node.cpp:35
void show()
Show node.
Definition node.h:77
QList< Wire * > Wires() const
Get list of connected wires.
Definition node.h:46
~Node()
Class destructor.
Definition node.h:35
QString getID()
Get node identifier.
Definition node.h:74
void addWire(Wire *Wire)
Add wire connection to node.
Definition node.h:39
QPoint getPortLocation(int)
Get port location (always returns origin)
Definition node.h:70
void mousePressEvent(QGraphicsSceneMouseEvent *event)
Handle mouse press events.
Definition node.h:87
QVariant itemChange(GraphicsItemChange change, const QVariant &value)
Handle item change events.
Definition node.cpp:49
QPainterPath shape() const
Get node selection shape.
Definition node.cpp:29
Abstract base class for schematic symbols.
Definition symbol.h:34
Wire connection between symbols.
Definition wire.h:21
void adjust()
Adjust wire geometry based on endpoint positions.
Definition wire.cpp:25
Wire connection between symbols (definition)