Commit 202e1d3c authored by Yann Boucher's avatar Yann Boucher
Browse files
parents 26f2bfc4 1f2d083d
Pipeline #78240 passed with stages
in 17 seconds
......@@ -347,41 +347,6 @@ pattern recorded :</string>
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>5</string>
</property>
</item>
<item>
<property name="text">
<string>6</string>
</property>
</item>
<item>
<property name="text">
<string>7</string>
</property>
</item>
<item>
<property name="text">
<string>8</string>
</property>
</item>
</widget>
</item>
</layout>
......@@ -460,16 +425,6 @@ pattern recorded :</string>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="nbrStatesComboBox">
<item>
<property name="text">
<string>0</string>
</property>
</item>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
......@@ -569,7 +524,7 @@ pattern recorded :</string>
<x>0</x>
<y>0</y>
<width>1089</width>
<height>25</height>
<height>26</height>
</rect>
</property>
<widget class="QMenu" name="menuFichier">
......
......@@ -54,6 +54,8 @@ private slots:
//! \brief Créer une nouvelle grille ayant des états aléatoire
void on_randomPatternButton_clicked();
void on_nbrStatesComboBox_currentTextChanged(const QString &arg1);
private:
Ui::MainWindow *ui;
};
......
......@@ -189,3 +189,27 @@ void MainWindow::on_randomPatternButton_clicked()
ui->grid_view->copy_grid(newGrid);
}
void MainWindow::on_nbrStatesComboBox_currentTextChanged(const QString &arg1)
{
// Nombre d'états possibles
int val = arg1.toInt();
// Nombre de valeurs dans le comboxBox (en partant de 0)
int currentNbrValue = ui->nbrStateComboBox->count();
// Si on change le nbr d'états
if (val != currentNbrValue) {
// Si on ajoute des états
if (val > currentNbrValue) {
for(int i = currentNbrValue; i < val; i++ ) {
ui->nbrStateComboBox->addItem(QString::number(i));
}
}
// Si on retire des états
else {
for(int i = currentNbrValue - 1; i >= val; i-- ) {
ui->nbrStateComboBox->removeItem(i);
}
}
}
}
Supports Markdown
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