Added simulation functionality
This commit is contained in:
parent
79c5d147a3
commit
78da43f51d
23 changed files with 385 additions and 21 deletions
26
include/components/Switch.hpp
Normal file
26
include/components/Switch.hpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget.h>
|
||||
#include "ui_Component.h"
|
||||
#include "../Component.hpp"
|
||||
|
||||
class Switch : public Component
|
||||
{
|
||||
public:
|
||||
Switch(QWidget* parent) : Component(parent, ":/components/switch_off.png") { type = "switch"; }
|
||||
|
||||
bool Action() override {
|
||||
return state;
|
||||
}
|
||||
|
||||
void Toggle() {
|
||||
state = !state;
|
||||
if (state)
|
||||
ui->label->setPixmap(QPixmap(":/components/switch_on.png"));
|
||||
else
|
||||
ui->label->setPixmap(QPixmap(":/components/switch_off.png"));
|
||||
}
|
||||
|
||||
private:
|
||||
bool state = false;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue