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
96488416
Commit
96488416
authored
3 years ago
by
Matthias Puchner
Browse files
Options
Downloads
Patches
Plain Diff
improve unit switching (two auto-exclusive actions)
parent
2f7ee5d5
No related branches found
No related tags found
1 merge request
!415
Unit handling in layer oriented sample editor
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Views/SampleDesigner/LayerOrientedSampleEditor.cpp
+26
-8
26 additions, 8 deletions
GUI/Views/SampleDesigner/LayerOrientedSampleEditor.cpp
GUI/Views/SampleDesigner/LayerOrientedSampleEditor.h
+2
-2
2 additions, 2 deletions
GUI/Views/SampleDesigner/LayerOrientedSampleEditor.h
with
28 additions
and
10 deletions
GUI/Views/SampleDesigner/LayerOrientedSampleEditor.cpp
+
26
−
8
View file @
96488416
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include
"GUI/Views/SampleDesigner/MultiLayerForm.h"
#include
"GUI/Views/SampleDesigner/MultiLayerForm.h"
#include
"GUI/Views/SampleDesigner/SampleEditorController.h"
#include
"GUI/Views/SampleDesigner/SampleEditorController.h"
#include
"GUI/Application/Application.h"
#include
<QBoxLayout>
#include
<QBoxLayout>
#include
<QScrollArea>
#include
<QScrollArea>
...
@@ -29,7 +30,7 @@ LayerOrientedSampleEditor::LayerOrientedSampleEditor(QWidget* parent)
...
@@ -29,7 +30,7 @@ LayerOrientedSampleEditor::LayerOrientedSampleEditor(QWidget* parent)
,
m_undoAction
(
nullptr
)
,
m_undoAction
(
nullptr
)
,
m_redoAction
(
nullptr
)
,
m_redoAction
(
nullptr
)
,
m_showInlineEditButtonsAction
(
nullptr
)
,
m_showInlineEditButtonsAction
(
nullptr
)
,
m_asAngstrom
(
nullptr
)
,
m_asAngstrom
Action
(
nullptr
)
,
m_currentMultiLayerItem
(
nullptr
)
,
m_currentMultiLayerItem
(
nullptr
)
{
{
setAttribute
(
Qt
::
WA_StyledBackground
,
true
);
setAttribute
(
Qt
::
WA_StyledBackground
,
true
);
...
@@ -55,11 +56,27 @@ LayerOrientedSampleEditor::LayerOrientedSampleEditor(QWidget* parent)
...
@@ -55,11 +56,27 @@ LayerOrientedSampleEditor::LayerOrientedSampleEditor(QWidget* parent)
m_showInlineEditButtonsAction
->
setChecked
(
false
);
m_showInlineEditButtonsAction
->
setChecked
(
false
);
m_toolbar
->
addAction
(
m_showInlineEditButtonsAction
);
m_toolbar
->
addAction
(
m_showInlineEditButtonsAction
);
m_asAngstrom
=
new
QAction
(
"A"
,
this
);
m_asAngstromAction
=
new
QAction
(
"A"
,
this
);
// #baLayerEditor use icon, not text
connect
(
m_asAngstrom
,
&
QAction
::
toggled
,
this
,
&
LayerOrientedSampleEditor
::
onAsAngstromToggled
);
m_asAngstromAction
->
setToolTip
(
"Use
\303\205
ngstrom as unit (where applicable)"
);
m_asAngstrom
->
setCheckable
(
true
);
connect
(
m_asAngstromAction
,
&
QAction
::
toggled
,
this
,
m_asAngstrom
->
setChecked
(
false
);
&
LayerOrientedSampleEditor
::
onUnitActionToggled
);
m_toolbar
->
addAction
(
m_asAngstrom
);
m_asAngstromAction
->
setCheckable
(
true
);
auto
*
asNanometerAction
=
new
QAction
(
"nm"
,
this
);
// #baLayerEditor use icon, not text
asNanometerAction
->
setToolTip
(
"Use nanometer as unit (where applicable)"
);
connect
(
asNanometerAction
,
&
QAction
::
toggled
,
this
,
&
LayerOrientedSampleEditor
::
onUnitActionToggled
);
asNanometerAction
->
setCheckable
(
true
);
auto
*
ag
=
new
QActionGroup
(
this
);
ag
->
addAction
(
asNanometerAction
);
ag
->
addAction
(
m_asAngstromAction
);
if
(
baApp
->
settings
().
defaultUnitIsAngstrom
())
m_asAngstromAction
->
setChecked
(
true
);
else
asNanometerAction
->
setChecked
(
true
);
m_toolbar
->
addActions
(
ag
->
actions
());
}
}
LayerOrientedSampleEditor
::~
LayerOrientedSampleEditor
()
LayerOrientedSampleEditor
::~
LayerOrientedSampleEditor
()
...
@@ -108,6 +125,7 @@ void LayerOrientedSampleEditor::setCurrentSample(MultiLayerItem* multiLayerItem)
...
@@ -108,6 +125,7 @@ void LayerOrientedSampleEditor::setCurrentSample(MultiLayerItem* multiLayerItem)
m_currentMultiLayerWidget
->
setSizePolicy
(
QSizePolicy
::
Minimum
,
QSizePolicy
::
Minimum
);
m_currentMultiLayerWidget
->
setSizePolicy
(
QSizePolicy
::
Minimum
,
QSizePolicy
::
Minimum
);
m_scrollArea
->
setWidget
(
m_currentMultiLayerWidget
);
m_scrollArea
->
setWidget
(
m_currentMultiLayerWidget
);
m_currentMultiLayerWidget
->
showInlineEditButtons
(
m_showInlineEditButtonsAction
->
isChecked
());
m_currentMultiLayerWidget
->
showInlineEditButtons
(
m_showInlineEditButtonsAction
->
isChecked
());
m_currentMultiLayerWidget
->
useAngstrom
(
m_asAngstromAction
->
isChecked
());
updateActionEnabling
();
updateActionEnabling
();
}
}
...
@@ -123,10 +141,10 @@ void LayerOrientedSampleEditor::onShowInlineEditButtonsToggled(bool checked)
...
@@ -123,10 +141,10 @@ void LayerOrientedSampleEditor::onShowInlineEditButtonsToggled(bool checked)
m_currentMultiLayerWidget
->
showInlineEditButtons
(
checked
);
m_currentMultiLayerWidget
->
showInlineEditButtons
(
checked
);
}
}
void
LayerOrientedSampleEditor
::
on
AsAngstrom
Toggled
()
void
LayerOrientedSampleEditor
::
on
UnitAction
Toggled
()
{
{
if
(
m_currentMultiLayerWidget
)
if
(
m_currentMultiLayerWidget
)
m_currentMultiLayerWidget
->
useAngstrom
(
m_asAngstrom
->
isChecked
());
m_currentMultiLayerWidget
->
useAngstrom
(
m_asAngstrom
Action
->
isChecked
());
}
}
void
LayerOrientedSampleEditor
::
createLayerColors
()
// #baLayerEditor move to better place
void
LayerOrientedSampleEditor
::
createLayerColors
()
// #baLayerEditor move to better place
...
...
This diff is collapsed.
Click to expand it.
GUI/Views/SampleDesigner/LayerOrientedSampleEditor.h
+
2
−
2
View file @
96488416
...
@@ -36,7 +36,7 @@ public:
...
@@ -36,7 +36,7 @@ public:
private:
private:
void
updateActionEnabling
();
void
updateActionEnabling
();
void
onShowInlineEditButtonsToggled
(
bool
checked
);
void
onShowInlineEditButtonsToggled
(
bool
checked
);
void
on
AsAngstrom
Toggled
();
void
on
UnitAction
Toggled
();
void
createLayerColors
();
void
createLayerColors
();
QWidget
*
createEmptyWidget
();
QWidget
*
createEmptyWidget
();
...
@@ -48,7 +48,7 @@ private:
...
@@ -48,7 +48,7 @@ private:
QAction
*
m_undoAction
;
// dedicated to the current sample
QAction
*
m_undoAction
;
// dedicated to the current sample
QAction
*
m_redoAction
;
QAction
*
m_redoAction
;
QAction
*
m_showInlineEditButtonsAction
;
QAction
*
m_showInlineEditButtonsAction
;
QAction
*
m_asAngstrom
;
// #baLayerEditor better two autoexclusive a
ction
s?
QAction
*
m_asAngstrom
A
ction
;
MultiLayerItem
*
m_currentMultiLayerItem
=
nullptr
;
MultiLayerItem
*
m_currentMultiLayerItem
=
nullptr
;
QMap
<
MultiLayerItem
*
,
SampleEditorController
*>
m_editControllers
;
QMap
<
MultiLayerItem
*
,
SampleEditorController
*>
m_editControllers
;
};
};
...
...
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