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
2fe101c3
Commit
2fe101c3
authored
May 21, 2021
by
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
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
forms/interface.ui
View file @
2fe101c3
...
@@ -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"
>
...
...
include/gridview.hpp
View file @
2fe101c3
...
@@ -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:
...
...
include/interface.hpp
View file @
2fe101c3
...
@@ -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
);
...
...
src/gridview.cpp
View file @
2fe101c3
...
@@ -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
();
}
}
...
...
src/interface.cpp
View file @
2fe101c3
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
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