Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
Pipeline #78303 passed
......@@ -231,7 +231,7 @@ pattern recorded :</string>
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
......
......@@ -60,6 +60,7 @@ public:
Grid get_grid() const;
void clear_selection();
void fill_selection(unsigned state);
Structure selected_cells() const;
private:
......
......@@ -58,6 +58,9 @@ private slots:
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
void copy_structure_clicked(const Structure& s);
......
......@@ -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())
{
GridItem* item = static_cast<GridItem*>(abstract_item);
item->setBrush(QBrush(stateColor_to_QColor(m_alph.getState(0).getColor())));
item->cell_state = 0;
item->setBrush(QBrush(stateColor_to_QColor(m_alph.getState(state).getColor())));
item->cell_state = state;
item->update();
}
}
void GridView::delete_selection()
{
fill_selection(0);
clear_selection();
}
......
......@@ -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)
{
ui->grid_view->set_clipboard(s);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment