Verified Commit b24cd4c3 authored by Romain De Laage De Bellefaye's avatar Romain De Laage De Bellefaye 🌳
Browse files

Add paramalpha

parent ecc87ee6
#ifndef _PARAMALPHA_H
#define _PARAMALPHA_H
class ParamAlpha: public QObject {
Q_OBJECT
private:
EnsembleEtat ense;
QGridLayout *general;
QFormLayout* form[8];
QLineEdit* label[8];
QSpinBox* red[8];
QSpinBox* green[8];
QSpinBox* blue[8];
QPushButton valider("Valider", this);
public slots:
void addEtats();
void valide();
};
#endif
#include <paramalpha.h>
void ParamAlpha::addEtats() {
this->setWindowTitle("Configuration des états");
this->setMinimumSize(900, 700);
general = new QGridLayout;
this->setLayout(general);
valider = new QPushButton("Valider");
for(size_t i = 0; i < 8; ++i) {
form[i] = new QFormLayout;
red[i] = new QSpinBox;
green[i] = new QSpinBox;
blue[i] = new QSpinBox;
label[i] = new QLineEdit;
red[i].setRange(0,255);
green[i].setRange(0,255);
blue[i].setRange(0,255);
std::string formLabel = "Etat ";
formLabel = formLabel + std::to_string(i);
form[i].addWidget(new QLabel(formLabel.c_str()));
form[i].addRow("Label:", label[i]);
form[i].addRow("Rouge:", red[i]);
form[i].addRow("Vert:", green[i]);
form[i].addRow("Bleu:", blue[i]);
}
connect(valider, SIGNAL(clicked()), this, SLOT(valide()));
general->addWidget(form[0], 0, 0, 1, 1);
general->addWidget(form[0], 0, 1, 1, 1);
general->addWidget(form[0], 0, 2, 1, 1);
general->addWidget(form[0], 1, 0, 1, 1);
general->addWidget(form[0], 1, 1, 1, 1);
general->addWidget(form[0], 1, 2, 1, 1);
general->addWidget(form[0], 2, 0, 1, 1);
general->addWidget(form[0], 2, 1, 1, 1);
general->addWidget(valider, 2, 1, 1, 1);
}
void ParamAlpha::valide() {
EnsembleEtat& e = Automate::getInstance().getEnsemble();
e.reset();
for(size_t i = 0; i < 8; ++i) {
e.ajouterEtat(i, label[i].text().toStdString(), red[i].value(), green[i].value(), blue[i].value());
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment