Commit 2fe101c3 authored by Yann Boucher's avatar Yann Boucher
Browse files

Added the slot for drawCellButton; added support for filling the selection in GridView

parent fecfa7f3
Pipeline #78303 passed with stages
in 16 seconds
...@@ -231,7 +231,7 @@ pattern recorded :</string> ...@@ -231,7 +231,7 @@ pattern recorded :</string>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
......
...@@ -60,6 +60,7 @@ public: ...@@ -60,6 +60,7 @@ public:
Grid get_grid() const; Grid get_grid() const;
void clear_selection(); void clear_selection();
void fill_selection(unsigned state);
Structure selected_cells() const; Structure selected_cells() const;
private: private:
......
...@@ -58,6 +58,9 @@ private slots: ...@@ -58,6 +58,9 @@ private slots:
void on_nbrStatesComboBox_currentTextChanged(const QString &arg1); void on_nbrStatesComboBox_currentTextChanged(const QString &arg1);
//! \brief Applique l'état sélectionné aux cellules sélectionnées de la GridView
void on_drawCellButton_clicked();
//! \brief Copie la structure choisie dans la bibliothèque dans le presse-papier du GridView //! \brief Copie la structure choisie dans la bibliothèque dans le presse-papier du GridView
void copy_structure_clicked(const Structure& s); void copy_structure_clicked(const Structure& s);
......
...@@ -274,15 +274,20 @@ void GridView::paste_clipboard() ...@@ -274,15 +274,20 @@ void GridView::paste_clipboard()
} }
void GridView::delete_selection() void GridView::fill_selection(unsigned state)
{ {
for (auto& abstract_item : m_scene->selectedItems()) for (auto& abstract_item : m_scene->selectedItems())
{ {
GridItem* item = static_cast<GridItem*>(abstract_item); GridItem* item = static_cast<GridItem*>(abstract_item);
item->setBrush(QBrush(stateColor_to_QColor(m_alph.getState(0).getColor()))); item->setBrush(QBrush(stateColor_to_QColor(m_alph.getState(state).getColor())));
item->cell_state = 0; item->cell_state = state;
item->update(); item->update();
} }
}
void GridView::delete_selection()
{
fill_selection(0);
clear_selection(); clear_selection();
} }
......
...@@ -215,6 +215,11 @@ void MainWindow::on_nbrStatesComboBox_currentTextChanged(const QString &arg1) ...@@ -215,6 +215,11 @@ void MainWindow::on_nbrStatesComboBox_currentTextChanged(const QString &arg1)
} }
void MainWindow::on_drawCellButton_clicked()
{
ui->grid_view->fill_selection(ui->nbrStateComboBox->currentIndex());
}
void MainWindow::copy_structure_clicked(const Structure &s) void MainWindow::copy_structure_clicked(const Structure &s)
{ {
ui->grid_view->set_clipboard(s); ui->grid_view->set_clipboard(s);
......
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