wiRedPanda
Home
About
Download
Try out
API Docs
wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
InputButton.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
10
#include "
App/Element/GraphicElementInput.h
"
11
19
class
InputButton
:
public
GraphicElementInput
20
{
21
Q_OBJECT
22
23
public
:
24
// --- Lifecycle ---
25
27
explicit
InputButton
(QGraphicsItem *parent =
nullptr
);
28
29
// --- State Queries ---
30
32
bool
isOn
(
const
int
port = 0)
const override
;
33
34
// --- State Setters ---
35
37
void
setOff
()
override
;
38
40
void
setOn
()
override
;
41
42
// Bring the base setOn(bool, int) overload into scope (hidden by setOn() above).
43
using
GraphicElementInput::setOn
;
44
46
QList<std::pair<int, QString>>
appearanceStates
()
const override
;
47
48
// --- Serialization ---
49
51
void
load
(QDataStream &stream,
SerializationContext
&context)
override
;
53
void
save
(QDataStream &stream,
SerializationOptions
options)
const override
;
54
55
protected
:
56
// --- Event handlers ---
57
59
void
mousePressEvent
(QGraphicsSceneMouseEvent *event)
override
;
61
void
mouseReleaseEvent
(QGraphicsSceneMouseEvent *event)
override
;
62
};
GraphicElementInput.h
Abstract base class for user-controllable input elements.
GraphicElementInput::setOn
virtual void setOn()=0
Sets all outputs to active (logic-1).
GraphicElementInput::GraphicElementInput
GraphicElementInput(ElementType type, QGraphicsItem *parent=nullptr)
Definition
GraphicElementInput.h:30
InputButton::setOff
void setOff() override
Drives all output ports logic-low (releases the button).
Definition
InputButton.cpp:115
InputButton::load
void load(QDataStream &stream, SerializationContext &context) override
Definition
InputButton.cpp:90
InputButton::InputButton
InputButton(QGraphicsItem *parent=nullptr)
Constructs the element with optional parent.
Definition
InputButton.cpp:49
InputButton::mouseReleaseEvent
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
Definition
InputButton.cpp:66
InputButton::save
void save(QDataStream &stream, SerializationOptions options) const override
Definition
InputButton.cpp:76
InputButton::appearanceStates
QList< std::pair< int, QString > > appearanceStates() const override
Definition
InputButton.cpp:125
InputButton::isOn
bool isOn(const int port=0) const override
Returns true if output port port is driven logic-high.
Definition
InputButton.cpp:109
InputButton::setOn
void setOn() override
Presses the button (logic-1).
Definition
InputButton.cpp:120
InputButton::mousePressEvent
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
Definition
InputButton.cpp:55
SerializationContext
Bundles all per-deserialization state so that load() overrides receive it through one explicit parame...
Definition
SerializationContext.h:61
SerializationOptions
Options passed to GraphicElement::save() (and friends); the save-side counterpart of SerializationCon...
Definition
SerializationContext.h:80
App
Element
GraphicElements
InputButton.h
Generated by
1.16.1