Unverified Commit 16baf339 authored by Merwane Bouri's avatar Merwane Bouri
Browse files

Ajout du bouton reset grid (la satisfaction quand ça marche :) )

parent f917721b
......@@ -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>25</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFichier">
......
......@@ -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();
......
......@@ -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);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment