wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
Node.h
Go to the documentation of this file.
1// Copyright 2015 - 2026, GIBIS-UNIFESP and the wiRedPanda contributors
2// SPDX-License-Identifier: GPL-3.0-or-later
3
7
8#pragma once
9
11
12class QGraphicsPixmapItem;
13
23class Node : public GraphicElement
24{
25 Q_OBJECT
26
27public:
28 // --- Lifecycle ---
29
31 explicit Node(QGraphicsItem *parent = nullptr);
32
33 // --- Visual ---
34
36 void updatePortsProperties() override;
37
39 void updateLogic() override;
40
41 // --- Wireless mode ---
42
44 WirelessMode wirelessMode() const override;
45
47 bool hasWirelessMode() const override;
48
57
58 // --- Serialization ---
59
60 void save(QDataStream &stream, SerializationOptions options) const override;
61 void load(QDataStream &stream, SerializationContext &context) override;
62
63private:
64 void updateWirelessColor(Status status);
65
66 WirelessMode m_wirelessMode = WirelessMode::None;
67 QGraphicsPixmapItem *m_wirelessIndicator = nullptr;
68 QColor m_wirelessColor;
69};
Enums::Status Status
Definition Enums.h:106
Enums::WirelessMode WirelessMode
Definition Enums.h:109
Abstract base class for all graphical circuit elements.
GraphicElement(ElementType type, QGraphicsItem *parent=nullptr)
Constructs a graphic element of the given type, fetching all properties from the metadata registry.
Node(QGraphicsItem *parent=nullptr)
Constructs the element with optional parent.
Definition Node.cpp:54
WirelessMode wirelessMode() const override
Returns the current wireless routing mode (None / Tx / Rx).
Definition Node.cpp:110
void setWirelessMode(WirelessMode mode)
Sets the wireless routing mode and adjusts port requirements accordingly.
Definition Node.cpp:120
void updatePortsProperties() override
Recalculates port positions for the current port count.
Definition Node.cpp:69
bool hasWirelessMode() const override
Returns true — Node supports wireless mode configuration.
Definition Node.cpp:115
void save(QDataStream &stream, SerializationOptions options) const override
Definition Node.cpp:176
void load(QDataStream &stream, SerializationContext &context) override
Loads the graphic element through a binary data stream.
Definition Node.cpp:190
void updateLogic() override
Copies the single input value to the single output (pass-through).
Definition Node.cpp:77
Bundles all per-deserialization state so that load() overrides receive it through one explicit parame...
Options passed to GraphicElement::save() (and friends); the save-side counterpart of SerializationCon...