Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Romain De Laage De Bellefaye
LO21-projet
Commits
4c7be99c
Verified
Commit
4c7be99c
authored
Jun 10, 2021
by
Romain De Laage De Bellefaye
🌳
Browse files
Add paramalpha
parent
e0374063
Changes
4
Hide whitespace changes
Inline
Side-by-side
includes/paramalpha.h
View file @
4c7be99c
...
...
@@ -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
();
};
...
...
includes/parametragemodele.h
View file @
4c7be99c
...
...
@@ -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
();
};
...
...
src/paramalpha.cpp
View file @
4c7be99c
#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
()
{
...
...
src/parametragemodele.cpp
View file @
4c7be99c
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment