Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
15bce2ba
Commit
15bce2ba
authored
1 year ago
by
Mikhail Svechnikov
Committed by
Wuttke, Joachim
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
add m_duplicateAction
parent
cda6e8ea
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/View/SampleDesigner/LayerForm.cpp
+53
-34
53 additions, 34 deletions
GUI/View/SampleDesigner/LayerForm.cpp
GUI/View/SampleDesigner/LayerForm.h
+1
-0
1 addition, 0 deletions
GUI/View/SampleDesigner/LayerForm.h
with
54 additions
and
34 deletions
GUI/View/SampleDesigner/LayerForm.cpp
+
53
−
34
View file @
15bce2ba
...
...
@@ -42,42 +42,61 @@ LayerForm::LayerForm(QWidget* parent, LayerItem* layer, SampleEditorController*
connect
(
m_collapser
,
&
GroupBoxCollapser
::
toggled
,
this
,
[
layer
](
bool
b
)
{
layer
->
setExpandLayer
(
b
);
});
m_removeAction
=
ActionFactory
::
createRemoveAction
(
this
,
"layer"
,
[
ec
,
layer
]
{
ec
->
removeLayerItem
(
layer
);
});
auto
*
chooseColorAction
=
new
QAction
(
this
);
chooseColorAction
->
setText
(
"Choose color"
);
chooseColorAction
->
setIcon
(
QIcon
(
":/images/palette.svg"
));
chooseColorAction
->
setIconText
(
"Choose color"
);
chooseColorAction
->
setToolTip
(
"Choose a color for this layer"
);
auto
*
menu
=
new
QMenu
(
this
);
chooseColorAction
->
setMenu
(
menu
);
for
(
const
auto
&
col
:
LayerEditorUtil
::
predefinedLayerColors
())
{
QPixmap
p
(
64
,
64
);
p
.
fill
(
col
);
auto
*
ca
=
menu
->
addAction
(
QIcon
(
p
),
""
);
connect
(
ca
,
&
QAction
::
triggered
,
[
this
,
layer
,
col
]()
{
layer
->
setColor
(
col
);
updateColor
();
});
// top right corner actions
// choose color
{
auto
*
chooseColorAction
=
new
QAction
(
this
);
chooseColorAction
->
setText
(
"Choose color"
);
chooseColorAction
->
setIcon
(
QIcon
(
":/images/palette.svg"
));
chooseColorAction
->
setIconText
(
"Choose color"
);
chooseColorAction
->
setToolTip
(
"Choose a color for this layer"
);
auto
*
menu
=
new
QMenu
(
this
);
chooseColorAction
->
setMenu
(
menu
);
m_collapser
->
addAction
(
chooseColorAction
);
for
(
const
auto
&
col
:
LayerEditorUtil
::
predefinedLayerColors
())
{
QPixmap
p
(
64
,
64
);
p
.
fill
(
col
);
auto
*
ca
=
menu
->
addAction
(
QIcon
(
p
),
""
);
connect
(
ca
,
&
QAction
::
triggered
,
[
this
,
layer
,
col
]()
{
layer
->
setColor
(
col
);
updateColor
();
});
}
}
// move
{
m_moveButton
=
new
WidgetMoverButton
(
this
,
this
,
1
);
m_moveButton
->
setToolTip
(
"Move layer up/down"
);
connect
(
m_moveButton
,
&
WidgetMoverButton
::
startingToMove
,
ec
,
&
SampleEditorController
::
onStartingToMoveLayer
);
connect
(
m_moveButton
,
&
WidgetMoverButton
::
finishedMoving
,
ec
,
&
SampleEditorController
::
onStoppedToMoveLayer
);
m_collapser
->
addWidget
(
m_moveButton
);
m_structureEditingWidgets
<<
m_moveButton
;
}
// show in real space
{
auto
*
showInRealspaceAction
=
ActionFactory
::
createShowInRealspaceAction
(
this
,
"layer"
,
[
this
,
layer
]
{
m_ec
->
requestViewInRealspace
(
layer
);
});
m_collapser
->
addAction
(
showInRealspaceAction
);
}
// duplicate
{
m_duplicateAction
=
new
QAction
(
this
);
m_duplicateAction
->
setIcon
(
QIcon
(
":/images/content-copy.svg"
));
m_duplicateAction
->
setToolTip
(
"Duplicate layer"
);
connect
(
m_duplicateAction
,
&
QAction
::
triggered
,
[]()
{
qInfo
()
<<
"Duplicate layer"
;
});
m_collapser
->
addAction
(
m_duplicateAction
);
}
// remove
{
m_removeAction
=
ActionFactory
::
createRemoveAction
(
this
,
"layer"
,
[
ec
,
layer
]
{
ec
->
removeLayerItem
(
layer
);
});
m_collapser
->
addAction
(
m_removeAction
);
}
m_moveButton
=
new
WidgetMoverButton
(
this
,
this
,
1
);
m_moveButton
->
setToolTip
(
"Move layer up/down"
);
connect
(
m_moveButton
,
&
WidgetMoverButton
::
startingToMove
,
ec
,
&
SampleEditorController
::
onStartingToMoveLayer
);
connect
(
m_moveButton
,
&
WidgetMoverButton
::
finishedMoving
,
ec
,
&
SampleEditorController
::
onStoppedToMoveLayer
);
auto
*
showInRealspaceAction
=
ActionFactory
::
createShowInRealspaceAction
(
this
,
"layer"
,
[
this
,
layer
]
{
m_ec
->
requestViewInRealspace
(
layer
);
});
m_collapser
->
addAction
(
showInRealspaceAction
);
m_collapser
->
addAction
(
chooseColorAction
);
m_collapser
->
addAction
(
m_removeAction
);
m_collapser
->
addWidget
(
m_moveButton
);
m_structureEditingWidgets
<<
m_moveButton
;
QColor
bckgroundCol
=
m_layer
->
color
();
setStyleSheet
(
"QGroupBox {background-color: "
+
bckgroundCol
.
name
(
QColor
::
HexRgb
)
+
"}"
);
...
...
This diff is collapsed.
Click to expand it.
GUI/View/SampleDesigner/LayerForm.h
+
1
−
0
View file @
15bce2ba
...
...
@@ -42,6 +42,7 @@ private:
GroupBoxCollapser
*
m_collapser
;
std
::
unique_ptr
<
FormLayouter
>
m_layouter
;
LayerItem
*
m_layer
;
QAction
*
m_duplicateAction
;
QAction
*
m_removeAction
;
int
m_roughnessRow
=
-
1
;
int
m_thicknessRow
=
-
1
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment