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

Add paramalpha

parent e0374063
......@@ -9,7 +9,6 @@
#include <QWidget>
#include <QFormLayout>
#include <reseau_cellule_etats.h>
#include <Automate.h>
class ParamAlpha: public QWidget {
Q_OBJECT
......@@ -25,8 +24,9 @@ class ParamAlpha: public QWidget {
QSpinBox* blue[8];
QPushButton* valider;
public:
ParamAlpha(const int nbEtats);
public slots:
void addEtats(const int nbEtats);
void valide();
};
......
......@@ -2,6 +2,7 @@
#define PARAMETRAGEMODELE_H
#include <reseau_cellule_etats.h>
#include <paramalpha.h>
#include <QObject>
#include <QApplication>
......@@ -68,6 +69,8 @@ class NouveauModele : public QWidget {
//définition de la frame contenant la grille de sélection du voisinage
QTableWidget* grid;
std::unique_ptr<ParamAlpha> paramAlpha;
QPushButton* boutonEtat;
public:
NouveauModele(QWidget* parent = nullptr);
......@@ -78,6 +81,7 @@ public slots:
void modifGrille(const QModelIndex& index);
void paramRegle(const QString& choix_regle);
void choisirEtatCourant(bool checked);
void parametrerEtats();
};
......
#include <paramalpha.h>
#include <Automate.h>
void ParamAlpha::addEtats(const int nbEtats) {
if(nbEtats <= 0 || nbEtats > 8)
throw "Nombre invalide!";
nb = nbEtats;
ParamAlpha::ParamAlpha(const int nbEtats): QWidget(), nb(nbEtats) {
this->setWindowTitle("Configuration des états");
this->setMinimumSize(900, 700);
......@@ -36,20 +32,20 @@ void ParamAlpha::addEtats(const int nbEtats) {
general->addLayout(form[0], 0, 0, 1, 1);
if(nb >= 2)
general->addLayout(form[0], 0, 1, 1, 1);
general->addLayout(form[1], 0, 1, 1, 1);
if(nb >= 3)
general->addLayout(form[0], 0, 2, 1, 1);
general->addLayout(form[2], 0, 2, 1, 1);
if(nb >= 4)
general->addLayout(form[0], 1, 0, 1, 1);
general->addLayout(form[3], 1, 0, 1, 1);
if(nb >= 5)
general->addLayout(form[0], 1, 1, 1, 1);
general->addLayout(form[4], 1, 1, 1, 1);
if(nb >= 6)
general->addLayout(form[0], 1, 2, 1, 1);
general->addLayout(form[5], 1, 2, 1, 1);
if(nb >= 7)
general->addLayout(form[0], 2, 0, 1, 1);
general->addLayout(form[6], 2, 0, 1, 1);
if(nb == 8)
general->addLayout(form[0], 2, 1, 1, 1);
general->addWidget(valider, 2, 1, 1, 1);
general->addLayout(form[7], 2, 1, 1, 1);
general->addWidget(valider, 2, 2, 1, 1, Qt::AlignBottom);
}
void ParamAlpha::valide() {
......
......@@ -105,9 +105,18 @@ NouveauModele::NouveauModele(QWidget* parent) : QWidget() {
general->addWidget(fenetre_param, 0, 1, 9, 1);
*/
boutonEtat = new QPushButton("Etats");
boutonEtat->setFixedWidth(50);
connect(boutonEtat, SIGNAL(clicked()), this, SLOT(parametrerEtats()));
form_choix->addWidget(boutonEtat);
}
void NouveauModele::parametrerEtats() {
paramAlpha.reset(new ParamAlpha(nb_etats->value()));
paramAlpha->show();
}
void NouveauModele::paramVoisinage(const QString& choix_voisinage){
if(choix_voisinage == "Voisinage de von Neumann" || choix_voisinage == "Voisinage de Moore"){
delete form_rayon;
......
Markdown is supported
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