wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
Mux.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
19class Mux : public GraphicElement
20{
21 Q_OBJECT
22
23public:
24 // --- Lifecycle ---
25
27 explicit Mux(QGraphicsItem *parent = nullptr);
28
29 // --- Visual / Port Configuration ---
30
32 QRectF boundingRect() const override;
33
35 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
36
38 void updatePortsProperties() override;
39
41 void updateLogic() override;
42
43private:
44 void generatePixmap();
45
48 void drawBody(QPainter *painter);
49
55 static int calculateSelectLines(int totalInputs);
56};
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.
void updatePortsProperties() override
Recalculates port positions for the current port count.
Definition Mux.cpp:52
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
Definition Mux.cpp:147
void updateLogic() override
Routes the data input selected by the select lines to the output.
Definition Mux.cpp:164
Mux(QGraphicsItem *parent=nullptr)
Constructs the element with optional parent.
Definition Mux.cpp:46
QRectF boundingRect() const override
Definition Mux.cpp:89