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
3e0dbade
Commit
3e0dbade
authored
Jun 10, 2021
by
Maxime Goret
Browse files
parametrage modele
parent
4930e5c7
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
cellulut.pro.user
0 → 100644
View file @
3e0dbade
This diff is collapsed.
Click to expand it.
includes/parametragemodele.h
View file @
3e0dbade
...
...
@@ -49,7 +49,7 @@ class NouveauModele : public QWidget {
QLabel
*
seuilMin
;
QLabel
*
destination
;
QLabel
*
etatCourant
;
QLabel
*
etatCourant2
;
QLabel
*
etatCourant2
=
nullptr
;
QComboBox
*
valid_Etat
;
QSpinBox
*
numEtatCourant
;
...
...
@@ -61,15 +61,15 @@ class NouveauModele : public QWidget {
QLineEdit
*
numSeuilMin
[
8
];
QLineEdit
*
numSeuilMax
[
8
];
QVBoxLayout
*
layoutv
=
n
ew
QVBoxLayout
;
QHBoxLayout
*
layouth1
=
n
ew
QHBoxLayout
;
QHBoxLayout
*
layouth2
=
n
ew
QHBoxLayout
;
QHBoxLayout
*
layouth3
=
n
ew
QHBoxLayout
;
QHBoxLayout
*
layouth4
=
n
ew
QHBoxLayout
;
QVBoxLayout
*
layoutv
=
n
ullptr
;
QHBoxLayout
*
layouth1
=
n
ullptr
;
QHBoxLayout
*
layouth2
=
n
ullptr
;
QHBoxLayout
*
layouth3
=
n
ullptr
;
QHBoxLayout
*
layouth4
=
n
ullptr
;
QVBoxLayout
*
layoutv2
=
n
ew
QVBoxLayout
;
QHBoxLayout
*
layouth5
=
n
ew
QHBoxLayout
;
QHBoxLayout
*
layouth6
=
n
ew
QHBoxLayout
;
QVBoxLayout
*
layoutv2
=
n
ullptr
;
QHBoxLayout
*
layouth5
=
n
ullptr
;
QHBoxLayout
*
layouth6
=
n
ullptr
;
//définition de la frame paramétrage du choix
QWidget
*
fenetre_param
;
...
...
@@ -77,11 +77,11 @@ class NouveauModele : public QWidget {
QLabel
*
label_param
;
//Voisiange non arbitraire
QFormLayout
*
form_rayon
;
QFormLayout
*
form_rayon
=
nullptr
;
QSpinBox
*
rayon
;
//définition de la frame contenant la grille de sélection du voisinage
QTableWidget
*
grid
;
QTableWidget
*
grid
=
nullptr
;
std
::
unique_ptr
<
ParamAlpha
>
paramAlpha
;
QPushButton
*
boutonEtat
;
...
...
src/parametragemodele.cpp
View file @
3e0dbade
...
...
@@ -29,33 +29,26 @@ NouveauModele::NouveauModele(QWidget* parent) : QWidget() {
//choisir un voisinage
liste_voisinage
=
new
QComboBox
;
liste_voisinage
->
addItem
(
"--- select ---"
);
/*
liste_voisinage->addItem("Voisinage de Moore");
liste_voisinage->addItem("Voisinage de von Neumann");
liste_voisinage->addItem("Voisinage arbitraire");
//liste_voisinage->setPlaceholderText("--- select ---");
liste_voisinage
->
setPlaceholderText
(
"--- select ---"
);
liste_voisinage
->
setCurrentIndex
(
-
1
);
*/
connect
(
liste_voisinage
,
SIGNAL
(
currentTextChanged
(
const
QString
&
)),
this
,
SLOT
(
paramVoisinage
(
const
QString
&
)));
//choisir une règle de transition
liste_regle_transition
=
new
QComboBox
;
//liste_regle_transition->setPlaceholderText("--- select ---");
liste_regle_transition
->
setPlaceholderText
(
"--- select ---"
);
//liste_regle_transition->addItem("--- select ---");
liste_regle_transition
->
addItem
(
"Life Game"
);
liste_regle_transition
->
addItem
(
"Langston's Loop"
);
liste_regle_transition
->
addItem
(
"Brian's brain"
);
liste_regle_transition
->
addItem
(
"Circulaire de Griffeath"
);
liste_regle_transition
->
addItem
(
"Langston's Loop"
);
liste_regle_transition
->
addItem
(
"Nouvelle fonction de transition"
);
liste_regle_transition
->
setCurrentIndex
(
-
1
);
//connect(liste_regle_transition, SIGNAL(currentIndexChanged(int)), liste_voisinage, SLOT(setCurrentIndex(int)));
...
...
@@ -66,15 +59,8 @@ NouveauModele::NouveauModele(QWidget* parent) : QWidget() {
bouton_valide
->
setFixedWidth
(
50
);
//connect(bouton_valide, SIGNAL(clicked()), SLOT(affParametrage()));
//ajout regle :
form_choix
->
addRow
(
"Nombre d'états :"
,
nb_etats
);
form_choix
->
addRow
(
"Règle de transition :"
,
liste_regle_transition
);
form_choix
->
addRow
(
"Voisinage :"
,
liste_voisinage
);
...
...
@@ -106,16 +92,6 @@ NouveauModele::NouveauModele(QWidget* parent) : QWidget() {
connect
(
boutonEtat
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
parametrerEtats
()));
form_choix
->
addWidget
(
boutonEtat
);
form_choix
->
addRow
(
layoutv
);
layoutv
->
addLayout
(
layouth1
);
layoutv
->
addLayout
(
layouth2
);
layoutv
->
addLayout
(
layouth3
);
layoutv
->
addLayout
(
layouth4
);
form_choix
->
addRow
(
layoutv2
);
layoutv2
->
addLayout
(
layouth5
);
layoutv2
->
addLayout
(
layouth6
);
}
...
...
@@ -126,8 +102,9 @@ void NouveauModele::parametrerEtats() {
void
NouveauModele
::
paramVoisinage
(
const
QString
&
choix_voisinage
){
if
(
choix_voisinage
==
"Voisinage de von Neumann"
||
choix_voisinage
==
"Voisinage de Moore"
){
delete
form_rayon
;
delete
grid
;
if
(
form_rayon
!=
nullptr
)
delete
form_rayon
;
if
(
grid
!=
nullptr
)
delete
grid
;
form_rayon
=
new
QFormLayout
;
rayon
=
new
QSpinBox
;
...
...
@@ -160,6 +137,33 @@ void NouveauModele::paramRegle(const QString& choix_regle) {
if
(
choix_regle
==
"Nouvelle fonction de transition"
)
{
seuilValidator
=
new
QIntValidator
;
if
(
layouth1
!=
nullptr
)
delete
layouth1
;
if
(
layouth2
!=
nullptr
)
delete
layouth2
;
if
(
layouth3
!=
nullptr
)
delete
layouth3
;
if
(
layouth4
!=
nullptr
)
delete
layouth4
;
if
(
layoutv
!=
nullptr
)
delete
layoutv
;
if
(
layouth5
!=
nullptr
)
delete
layouth5
;
if
(
layouth6
!=
nullptr
)
delete
layouth6
;
if
(
layoutv2
!=
nullptr
)
delete
layoutv2
;
layouth1
=
new
QHBoxLayout
;
layouth2
=
new
QHBoxLayout
;
layouth3
=
new
QHBoxLayout
;
layouth4
=
new
QHBoxLayout
;
layoutv
=
new
QVBoxLayout
;
layouth6
=
new
QHBoxLayout
;
layouth5
=
new
QHBoxLayout
;
layoutv2
=
new
QVBoxLayout
;
form_choix
->
addRow
(
layoutv
);
layoutv
->
addLayout
(
layouth1
);
layoutv
->
addLayout
(
layouth2
);
layoutv
->
addLayout
(
layouth3
);
layoutv
->
addLayout
(
layouth4
);
seuilValidator
->
setRange
(
0
,
1
);
layouth1
->
addWidget
(
seuilMin
);
...
...
@@ -196,13 +200,31 @@ void NouveauModele::paramRegle(const QString& choix_regle) {
}
void
NouveauModele
::
choisirEtatCourant
(
const
QString
&
validEtat
){
etatCourant2
=
new
QLabel
(
"Etat Courant : "
);
fin
=
new
QPushButton
(
"Terminer"
);
next
=
new
QPushButton
(
"Règle suivante"
);
if
(
validEtat
==
"Oui"
){
if
(
layouth5
!=
nullptr
)
delete
layouth5
;
if
(
layouth6
!=
nullptr
)
delete
layouth6
;
if
(
layoutv2
!=
nullptr
)
delete
layoutv2
;
if
(
etatCourant2
!=
nullptr
)
delete
etatCourant2
;
layouth6
=
new
QHBoxLayout
;
layouth5
=
new
QHBoxLayout
;
layoutv2
=
new
QVBoxLayout
;
form_choix
->
addRow
(
layoutv2
);
layoutv2
->
addLayout
(
layouth5
);
layoutv2
->
addLayout
(
layouth6
);
etatCourant2
=
new
QLabel
(
"Etat Courant : "
);
numEtatCourant
=
new
QSpinBox
;
numEtatCourant
->
setRange
(
1
,
8
);
...
...
@@ -210,16 +232,28 @@ void NouveauModele::choisirEtatCourant(const QString& validEtat){
layouth5
->
addWidget
(
etatCourant2
);
layouth5
->
addWidget
(
numEtatCourant
);
layouth6
->
addWidget
(
fin
);
layouth6
->
addWidget
(
next
);
}
else
{
QHBoxLayout
*
layout
=
new
QHBoxLayout
;
form_choix
->
addRow
(
layout
);
layout
->
addWidget
(
fin
);
layout
->
addWidget
(
next
);
if
(
layouth5
!=
nullptr
)
delete
layouth5
;
if
(
layouth6
!=
nullptr
)
delete
layouth6
;
if
(
layoutv2
!=
nullptr
)
delete
layoutv2
;
if
(
etatCourant2
!=
nullptr
)
delete
etatCourant2
;
etatCourant2
=
new
QLabel
(
"Etat Courant non pris en compte "
);
layouth6
=
new
QHBoxLayout
;
layouth5
=
new
QHBoxLayout
;
layoutv2
=
new
QVBoxLayout
;
form_choix
->
addRow
(
layoutv2
);
layoutv2
->
addLayout
(
layouth5
);
layoutv2
->
addLayout
(
layouth6
);
layouth5
->
addWidget
(
etatCourant2
);
layouth6
->
addWidget
(
fin
);
layouth6
->
addWidget
(
next
);
}
...
...
@@ -228,9 +262,9 @@ void NouveauModele::choisirEtatCourant(const QString& validEtat){
void
NouveauModele
::
affGrille
()
{
delete
grid
;
if
(
grid
!=
nullptr
)
delete
grid
;
grid
=
new
QTableWidget
(
5
,
5
);
form_param
->
addWidget
(
grid
,
0
,
0
,
8
,
1
);
form_param
->
addWidget
(
grid
,
0
,
0
,
7
,
3
);
grid
->
horizontalHeader
()
->
setVisible
(
false
);
//Pas de nom pour les colonnes.
grid
->
verticalHeader
()
->
setVisible
(
false
);
...
...
@@ -240,8 +274,8 @@ void NouveauModele::affGrille() {
for
(
unsigned
int
i
=
0
;
i
<
5
;
i
++
){
for
(
unsigned
int
j
=
0
;
j
<
5
;
j
++
)
{
grid
->
setRowHeight
(
j
,
5
0
);
grid
->
setColumnWidth
(
j
,
5
0
);
grid
->
setRowHeight
(
j
,
8
0
);
grid
->
setColumnWidth
(
j
,
8
0
);
/*
int x = i-3;
...
...
@@ -287,7 +321,7 @@ void NouveauModele::modifGrille(const QModelIndex& index){
void
NouveauModele
::
changerVoisinage
(
const
QString
&
choix_regle
){
delete
liste_voisinage
;
//
delete liste_voisinage;
form_choix
->
removeRow
(
2
);
liste_voisinage
=
new
QComboBox
();
...
...
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