Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LO21_Pin_Noir_Boucher_Bouri_Detree
CellulutLO21
Commits
16baf339
Unverified
Commit
16baf339
authored
Jun 07, 2021
by
Merwane Bouri
Browse files
Ajout du bouton reset grid (la satisfaction quand ça marche :) )
parent
f917721b
Changes
3
Hide whitespace changes
Inline
Side-by-side
forms/interface.ui
View file @
16baf339
...
...
@@ -380,6 +380,13 @@ pattern recorded :</string>
</item>
</layout>
</item>
<item>
<widget
class=
"QPushButton"
name=
"pushButton"
>
<property
name=
"text"
>
<string>
Reset grid
</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
...
...
@@ -556,7 +563,7 @@ pattern recorded :</string>
<x>
0
</x>
<y>
0
</y>
<width>
1068
</width>
<height>
2
5
</height>
<height>
2
2
</height>
</rect>
</property>
<widget
class=
"QMenu"
name=
"menuFichier"
>
...
...
include/interface.hpp
View file @
16baf339
...
...
@@ -83,6 +83,11 @@ private slots:
void
on_recordSpinBox_valueChanged
(
int
arg1
);
void
on_pushButton_clicked
();
private:
//! \brief Initialiser la liste des transitions et voisinages disponibles
void
init_transition_neighborhood_list
();
...
...
src/interface.cpp
View file @
16baf339
...
...
@@ -676,3 +676,30 @@ void MainWindow::on_resetButton_clicked() {
void
MainWindow
::
on_recordSpinBox_valueChanged
(
int
newSize
)
{
simulation
.
setHistorySize
(
newSize
);
}
void
MainWindow
::
on_pushButton_clicked
()
{
Grid
oldGrid
=
ui
->
grid_view
->
get_grid
();
unsigned
nbrRow
=
oldGrid
.
get_rows
();
// rows = nbr de lignes => axe y
unsigned
nbrCol
=
oldGrid
.
get_col
();
// col = nbr de colonne => axe x
Grid
newGrid
(
nbrRow
,
nbrCol
);
for
(
unsigned
y
=
0
;
y
<
nbrRow
;
++
y
)
{
for
(
unsigned
x
=
0
;
x
<
nbrCol
;
++
x
)
{
unsigned
state
=
0
;
Coord
pos
=
{
static_cast
<
int
>
(
x
),
static_cast
<
int
>
(
y
)};
newGrid
.
set_cell
(
pos
,
state
);
}
}
ui
->
grid_view
->
copy_grid
(
newGrid
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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