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
e50c70e7
Commit
e50c70e7
authored
Jun 10, 2021
by
Maxime Goret
Browse files
Paramétrage modèle
parent
69b3d9e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
includes/parametragemodele.h
View file @
e50c70e7
...
...
@@ -55,11 +55,23 @@ class NouveauModele : public QWidget {
QSpinBox
*
numEtatCourant
;
QSpinBox
*
etatDest
;
QPushButton
*
fin
,
next
;
QPushButton
*
fin
;
QPushButton
*
next
;
QIntValidator
*
seuilValidator
;
QLineEdit
*
numSeuilMin
[
8
];
QLineEdit
*
numSeuilMax
[
8
];
QVBoxLayout
*
layoutv
=
new
QVBoxLayout
;
QHBoxLayout
*
layouth1
=
new
QHBoxLayout
;
QHBoxLayout
*
layouth2
=
new
QHBoxLayout
;
QHBoxLayout
*
layouth3
=
new
QHBoxLayout
;
QHBoxLayout
*
layouth4
=
new
QHBoxLayout
;
QVBoxLayout
*
layoutv2
=
new
QVBoxLayout
;
QHBoxLayout
*
layouth5
=
new
QHBoxLayout
;
QHBoxLayout
*
layouth6
=
new
QHBoxLayout
;
//définition de la frame paramétrage du choix
QWidget
*
fenetre_param
;
QGridLayout
*
form_param
;
...
...
src/parametragemodele.cpp
View file @
e50c70e7
...
...
@@ -12,7 +12,7 @@ NouveauModele::NouveauModele(QWidget* parent) : QWidget() {
fenetre_init
=
new
QWidget
;
fenetre_init
->
setStyleSheet
(
"background-color: rgb(204, 209, 209)"
);
fenetre_init
->
setFixedWidth
(
3
00
);
fenetre_init
->
setFixedWidth
(
5
00
);
label_init
=
new
QLabel
(
"Configuration du modèle :"
);
form_init
=
new
QGridLayout
(
fenetre_init
);
...
...
@@ -106,6 +106,17 @@ 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
);
}
void
NouveauModele
::
parametrerEtats
()
{
...
...
@@ -146,21 +157,26 @@ void NouveauModele::paramRegle(const QString& choix_regle) {
valid_Etat
->
addItem
(
"Non"
);
valid_Etat
->
setCurrentIndex
(
-
1
);
if
(
choix_regle
==
"Nouvelle fonction de transition"
)
{
seuilValidator
=
new
QIntValidator
;
seuilValidator
->
setRange
(
0
,
1
);
QVBoxLayout
*
layoutv
=
new
QVBoxLayout
;
QHBoxLayout
*
layouth1
=
new
QHBoxLayout
;
QHBoxLayout
*
layouth2
=
new
QHBoxLayout
;
QHBoxLayout
*
layouth3
=
new
QHBoxLayout
;
QHBoxLayout
*
layouth4
=
new
QHBoxLayout
;
form_choix
->
addRow
(
layoutv
);
layoutv
->
addLayout
(
layouth1
);
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
;
}
layouth1
->
addWidget
(
seuilMin
);
for
(
unsigned
int
i
=
0
;
i
<
8
;
i
++
)
{
numSeuilMin
[
i
]
=
new
QLineEdit
;
...
...
@@ -168,10 +184,12 @@ void NouveauModele::paramRegle(const QString& choix_regle) {
numSeuilMin
[
i
]
->
setMaxLength
(
2
);
numSeuilMin
[
i
]
->
setText
(
"-1"
);
numSeuilMin
[
i
]
->
setValidator
(
seuilValidator
);
if
(
i
<
nb_etats
->
value
()){
layouth1
->
addWidget
(
numSeuilMin
[
i
]);
}
}
layoutv
->
addLayout
(
layouth2
);
layouth2
->
addWidget
(
seuilMax
);
for
(
unsigned
int
i
=
0
;
i
<
8
;
i
++
)
{
numSeuilMax
[
i
]
=
new
QLineEdit
;
...
...
@@ -179,12 +197,13 @@ void NouveauModele::paramRegle(const QString& choix_regle) {
numSeuilMax
[
i
]
->
setMaxLength
(
2
);
numSeuilMax
[
i
]
->
setText
(
"-1"
);
numSeuilMax
[
i
]
->
setValidator
(
seuilValidator
);
if
(
i
<
nb_etats
->
value
()){
layouth2
->
addWidget
(
numSeuilMax
[
i
]);
}
}
layoutv
->
addLayout
(
layouth3
);
layouth3
->
addWidget
(
destination
);
layouth3
->
addWidget
(
etatDest
);
layoutv
->
addLayout
(
layouth4
);
layouth4
->
addWidget
(
etatCourant
);
layouth4
->
addWidget
(
valid_Etat
);
connect
(
valid_Etat
,
SIGNAL
(
currentTextChanged
(
const
QString
&
)),
this
,
SLOT
(
choisirEtatCourant
(
const
QString
&
)));
...
...
@@ -193,18 +212,31 @@ void NouveauModele::paramRegle(const QString& choix_regle) {
void
NouveauModele
::
choisirEtatCourant
(
const
QString
&
validEtat
){
etatCourant2
=
new
QLabel
(
"Etat Courant : "
);
QHBoxLayout
*
layout
=
new
QHBoxLayout
;
form_choix
->
addRow
(
layout
);
fin
=
new
QPushButton
(
"Terminer"
);
next
=
new
QPushButton
(
"Règle suivante"
);
if
(
validEtat
==
"Oui"
){
numEtatCourant
=
new
QSpinBox
;
numEtatCourant
->
setRange
(
1
,
8
);
layout
->
addWidget
(
etatCourant
);
layout
->
addWidget
(
numEtatCourant
);
layouth5
->
addWidget
(
etatCourant2
);
layouth5
->
addWidget
(
numEtatCourant
);
layouth6
->
addWidget
(
fin
);
layouth6
->
addWidget
(
next
);
}
else
{
delete
layout
;
QHBoxLayout
*
layout
=
new
QHBoxLayout
;
form_choix
->
addRow
(
layout
);
layout
->
addWidget
(
fin
);
layout
->
addWidget
(
next
);
}
}
...
...
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