Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
wire.h
1/*
2 * Copyright (C) 2019-2025 Andrés Martínez Mera - andresmmera@protonmail.com
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef WIRE_H
19#define WIRE_H
20
21#include <QGraphicsItem>
22#include <QPainter>
23#include <math.h>
24
25#include "symbol.h"
26
27class Symbol;
28
30class Wire : public QGraphicsItem {
31public:
32 Wire(Symbol* sourceNode, int port_num_source, Symbol* destNode,
33 int port_num_dest);
34 Wire();
35 ~Wire();
36
37 void setSource(Symbol*, int);
38 void setDestination(Symbol*, int);
39 void setColor(QColor);
40 void paintWire();
41
42 Symbol* sourceNode() const;
43 Symbol* destNode() const;
44
45 void adjust();
46
47 enum { Type = UserType + 2 };
48 int type() const { return Type; }
49 QPoint getPortLocation(int);
50
51protected:
52 QRectF boundingRect() const;
53 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
54 QWidget* widget);
55
56private:
57 Symbol *source, *dest;
58 QColor WireColor;
59 QPointF sourcePoint;
60 QPointF destPoint;
61 qreal arrowSize;
62 int port_num_source, port_num_dest;
63};
65
66#endif
Definition symbol.h:31
[0]
Definition wire.h:30