wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
DFlipFlop.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
12
21{
22 Q_OBJECT
23
24public:
25 // --- Lifecycle ---
26
28 explicit DFlipFlop(QGraphicsItem *parent = nullptr);
29
30 // --- Visual ---
31
32 static QString pixmapPath()
33 {
34 return ":/Components/Memory/" + ThemeManager::themePath() + "/D-flipflop.svg";
35 }
36
38 void updatePortsProperties() override;
39
41 void updateTheme() override;
43 void updateLogic() override;
44
46 void resetSimState() override;
47private:
48 Status m_simLastClk = Status::Inactive;
49 Status m_simLastValue = Status::Active;
50};
Enums::Status Status
Definition Enums.h:106
Abstract base class for all graphical circuit elements.
Theme management types and singleton ThemeManager.
DFlipFlop(QGraphicsItem *parent=nullptr)
Constructs the element with optional parent.
Definition DFlipFlop.cpp:40
void updateLogic() override
Updates output state on each rising clock edge.
Definition DFlipFlop.cpp:80
void updatePortsProperties() override
Updates port names for this flip-flop.
Definition DFlipFlop.cpp:47
void updateTheme() override
Refreshes the pixmap when the application theme changes.
Definition DFlipFlop.cpp:73
void resetSimState() override
Resets Q/~Q outputs and edge-detection state to power-on defaults.
static QString pixmapPath()
Definition DFlipFlop.h:32
GraphicElement(ElementType type, QGraphicsItem *parent=nullptr)
Constructs a graphic element of the given type, fetching all properties from the metadata registry.
static QString themePath()
Returns the resource path prefix for the current theme (e.g. "dark" or "light").