Added simulation functionality

This commit is contained in:
Robert 2020-12-02 21:18:53 +01:00
parent 79c5d147a3
commit 78da43f51d
23 changed files with 385 additions and 21 deletions

View file

@ -0,0 +1,24 @@
#pragma once
#include <QWidget.h>
#include "../Component.hpp"
class Lamp : public Component
{
public:
Lamp(QWidget* parent) : Component(parent, ":/components/lamp_off.png") { type = "lamp"; }
bool Action() override {
return connections[0]->Action();
}
void Turn(bool state) {
if (state)
ui->label->setPixmap(QPixmap(":/components/lamp_on.png"));
else
ui->label->setPixmap(QPixmap(":/components/lamp_off.png"));
}
private:
bool state = false;
};