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
933c5ae4
Verified
Commit
933c5ae4
authored
Jun 09, 2021
by
Romain De Laage De Bellefaye
🌳
Browse files
Add nb
parent
ad1841d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
includes/paramalpha.h
View file @
933c5ae4
...
...
@@ -6,6 +6,7 @@ class ParamAlpha: public QObject {
private:
EnsembleEtat
ense
;
int
nb
;
QGridLayout
*
general
;
QFormLayout
*
form
[
8
];
QLineEdit
*
label
[
8
];
...
...
@@ -15,7 +16,7 @@ class ParamAlpha: public QObject {
QPushButton
valider
(
"Valider"
,
this
);
public
slots
:
void
addEtats
();
void
addEtats
(
const
int
nbEtats
);
void
valide
();
};
...
...
src/paramalpha.cpp
View file @
933c5ae4
#include
<paramalpha.h>
void
ParamAlpha
::
addEtats
()
{
void
ParamAlpha
::
addEtats
(
const
int
nbEtats
)
{
if
(
nbEtats
<=
0
||
nbEtats
>
8
)
throw
"Nombre invalide!"
;
nb
=
nbEtats
;
this
->
setWindowTitle
(
"Configuration des états"
);
this
->
setMinimumSize
(
900
,
700
);
...
...
@@ -9,7 +14,7 @@ void ParamAlpha::addEtats() {
valider
=
new
QPushButton
(
"Valider"
);
for
(
size_t
i
=
0
;
i
<
8
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
nb
;
++
i
)
{
form
[
i
]
=
new
QFormLayout
;
red
[
i
]
=
new
QSpinBox
;
green
[
i
]
=
new
QSpinBox
;
...
...
@@ -30,13 +35,20 @@ void ParamAlpha::addEtats() {
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
);
if
(
nb
>=
2
)
general
->
addWidget
(
form
[
0
],
0
,
1
,
1
,
1
);
if
(
nb
>=
3
)
general
->
addWidget
(
form
[
0
],
0
,
2
,
1
,
1
);
if
(
nb
>=
4
)
general
->
addWidget
(
form
[
0
],
1
,
0
,
1
,
1
);
if
(
nb
>=
5
)
general
->
addWidget
(
form
[
0
],
1
,
1
,
1
,
1
);
if
(
nb
>=
6
)
general
->
addWidget
(
form
[
0
],
1
,
2
,
1
,
1
);
if
(
nb
>=
7
)
general
->
addWidget
(
form
[
0
],
2
,
0
,
1
,
1
);
if
(
nb
==
8
)
general
->
addWidget
(
form
[
0
],
2
,
1
,
1
,
1
);
general
->
addWidget
(
valider
,
2
,
1
,
1
,
1
);
}
...
...
@@ -44,7 +56,7 @@ void ParamAlpha::valide() {
EnsembleEtat
&
e
=
Automate
::
getInstance
().
getEnsemble
();
e
.
reset
();
for
(
size_t
i
=
0
;
i
<
8
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
nb
;
++
i
)
{
e
.
ajouterEtat
(
i
,
label
[
i
].
text
().
toStdString
(),
red
[
i
].
value
(),
green
[
i
].
value
(),
blue
[
i
].
value
());
}
}
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