|
wiRedPanda
Logic Circuit Simulator
|
A port that receives a signal (the destination end of a wire). More...
#include <Port.h>
Public Member Functions | |
| InputPort (QGraphicsItem *parent=nullptr) | |
| Constructs an input port attached to parent. | |
| bool | isInput () const override |
| bool | isOutput () const override |
| bool | isValid () const override |
| void | setStatus (const Status status) override |
| ~InputPort () override | |
| Public Member Functions inherited from Port | |
| void | attachConnection (Connection *conn) |
| Registers conn as a connection attached to this port. | |
| QRectF | boundingRect () const override |
| const QList< Connection * > & | connections () const |
| Returns the list of wires attached to this port. | |
| QPen | currentPen () const |
| Returns the pen paint() draws the port outline with for its current status. | |
| Status | defaultValue () const |
| Returns the default status applied when the port is unconnected. | |
| void | detachConnection (Connection *conn) |
| Removes conn from this port's connection list. | |
| int | globalIndex () const |
| GraphicElement * | graphicElement () |
| Returns the graphic element that owns this port. | |
| const GraphicElement * | graphicElement () const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| void | hoverEnter () |
| Applies hover-enter visual feedback. | |
| void | hoverLeave () |
| Reverts hover-enter visual feedback. | |
| int | index () const |
| Returns the port's visual/logical index within the element. | |
| bool | isConnected (Port *otherPort) |
Returns true if this port is connected to otherPort via any wire. | |
| bool | isRequired () const |
Returns true if a connection to this port is mandatory. | |
| QString | name () const |
| Returns the port's label text. | |
| void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override |
| Port (QGraphicsItem *parent=nullptr) | |
| Constructs the port with optional parent item. | |
| void | setCurrentBrush (const QBrush ¤tBrush) |
| Sets the brush used to fill the port shape. | |
| void | setDefaultStatus (const Status defaultStatus) |
| Sets the status applied when the port has no connection. | |
| void | setGraphicElement (GraphicElement *graphicElement) |
| Binds this port to graphicElement. | |
| void | setIndex (const int index) |
| Sets the port's visual index within the element. | |
| void | setName (const QString &name) |
| Sets the label text shown next to the port. | |
| void | setRequired (const bool required) |
| Marks whether a wire to this port is mandatory. | |
| QPainterPath | shape () const override |
| Status | status () const |
| Returns the current logical status (Active/Inactive/Unknown/Error). | |
| int | type () const override |
| void | updateConnections () |
| Triggers a path update on all attached connections. | |
| void | updateTheme () |
| Reapplies the status-based pen and brush from the current ThemeManager palette. | |
| virtual | ~Port ()=default |
Additional Inherited Members | |
| Public Types inherited from Port | |
| enum | { Type = QGraphicsItem::UserType + 1 } |
| Static Public Member Functions inherited from Port | |
| static quint64 | makeSerialId (quint64 elementBase, int globalIndex) |
| Protected Member Functions inherited from Port | |
| void | drainConnections (bool isInput) |
| Drains all attached connections, breaking back-references before deletion. | |
| QVariant | itemChange (GraphicsItemChange change, const QVariant &value) override |
| Protected Attributes inherited from Port | |
| QList< Connection * > | m_connections |
| QBrush | m_currentBrush |
| QPen | m_currentPen |
| Status | m_defaultStatus = Status::Unknown |
| GraphicElement * | m_graphicElement = nullptr |
| int | m_index = 0 |
| QString | m_name |
| bool | m_required = true |
| Status | m_status = Status::Unknown |
| Static Protected Attributes inherited from Port | |
| static constexpr int | kRadius = 5 |
A port that receives a signal (the destination end of a wire).
Input ports are valid when they have exactly one connected wire or when they are optional (isRequired() == false).
|
explicit |
Constructs an input port attached to parent.
Definition at line 279 of file Port.cpp.
References isValid(), Port::kRadius, Port::m_status, Port::Port(), and Port::updateTheme().
|
override |
Definition at line 299 of file Port.cpp.
References Port::drainConnections().
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
Implements Port.
Definition at line 331 of file Port.cpp.
References Port::isRequired(), and Port::m_connections.
Referenced by InputPort(), and setStatus().
|
overridevirtual |
Implements Port.
Definition at line 307 of file Port.cpp.
References isValid(), Port::m_status, Port::status(), and Port::updateTheme().
Referenced by Connection::setEndPort(), and Connection::setStatus().