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
72bd83e8
Commit
72bd83e8
authored
7 months ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
SourceItem.Footprint using PolyPtr
parent
1e57e6c7
No related branches found
Branches containing commit
No related tags found
1 merge request
!2696
PolyItem -> PolyPtr, with BaseItem as separate template parameter
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GUI/Model/Beam/SourceItems.h
+3
-3
3 additions, 3 deletions
GUI/Model/Beam/SourceItems.h
GUI/View/Device/FootprintForm.cpp
+1
-1
1 addition, 1 deletion
GUI/View/Device/FootprintForm.cpp
GUI/View/Numeric/ComboUtil.h
+25
-2
25 additions, 2 deletions
GUI/View/Numeric/ComboUtil.h
with
29 additions
and
6 deletions
GUI/Model/Beam/SourceItems.h
+
3
−
3
View file @
72bd83e8
...
...
@@ -17,7 +17,7 @@
#include
"GUI/Model/Beam/FootprintCatalog.h"
#include
"GUI/Model/Descriptor/DoubleProperty.h"
#include
"GUI/Model/Descriptor/Poly
Item
.h"
#include
"GUI/Model/Descriptor/Poly
Ptr
.h"
#include
<functional>
#include
<heinz/Vectors3D.h>
...
...
@@ -43,7 +43,7 @@ public:
BeamDistributionItem
*
azimuthalAngleItem
()
const
;
void
setAzimuthalAngle
(
double
value
);
PolyItem
<
FootprintCatalog
>&
footprintSelection
()
{
return
m_footprint
;
}
Poly
Ptr
<
Footprint
Item
,
FootprintCatalog
>&
footprintSelection
()
{
return
m_footprint
;
}
void
setFootprintItem
(
const
IFootprint
*
footprint
);
void
setGaussianFootprint
(
double
value
);
void
setSquareFootprint
(
double
value
);
...
...
@@ -60,7 +60,7 @@ protected:
DoubleProperty
m_intensity
;
std
::
unique_ptr
<
BeamDistributionItem
>
m_wavelength_item
;
std
::
unique_ptr
<
BeamDistributionItem
>
m_azimuthal_angle_item
;
PolyItem
<
FootprintCatalog
>
m_footprint
;
Poly
Ptr
<
Footprint
Item
,
FootprintCatalog
>
m_footprint
;
};
class
BeamItem
:
public
SourceItem
{
...
...
This diff is collapsed.
Click to expand it.
GUI/View/Device/FootprintForm.cpp
+
1
−
1
View file @
72bd83e8
...
...
@@ -28,7 +28,7 @@ FootprintForm::FootprintForm(QWidget* parent, SourceItem* item)
{
m_form_layout
->
setFieldGrowthPolicy
(
QFormLayout
::
FieldsStayAtSizeHint
);
ASSERT
(
item
->
footprintSelection
().
certainItem
());
auto
*
typeCombo
=
GUI
::
Util
::
createComboBoxFromPoly
item
(
auto
*
typeCombo
=
GUI
::
Util
::
createComboBoxFromPoly
Ptr
(
item
->
footprintSelection
(),
[
this
](
int
)
{
updateFootprintWidgets
();
...
...
This diff is collapsed.
Click to expand it.
GUI/View/Numeric/ComboUtil.h
+
25
−
2
View file @
72bd83e8
...
...
@@ -16,6 +16,7 @@
#define BORNAGAIN_GUI_VIEW_NUMERIC_COMBOUTIL_H
#include
"GUI/Model/Descriptor/PolyItem.h"
#include
"GUI/Model/Descriptor/PolyPtr.h"
#include
"GUI/View/Base/CustomEventFilters.h"
#include
<QComboBox>
...
...
@@ -46,8 +47,8 @@ QComboBox* createComboBox(std::function<ComboProperty()> comboFunction,
//!
//! Changes in the combobox will be notified to the PolyItem already. The additional (and
//! optional) slot can be used to be notified about an already executed change.
template
<
typename
T
>
QComboBox
*
createComboBoxFromPolyitem
(
PolyItem
<
T
>&
d
,
std
::
function
<
void
(
int
)
>
slot
,
template
<
typename
C
>
QComboBox
*
createComboBoxFromPolyitem
(
PolyItem
<
C
>&
d
,
std
::
function
<
void
(
int
)
>
slot
,
bool
inScrollArea
)
{
auto
*
combo
=
new
QComboBox
;
...
...
@@ -68,6 +69,28 @@ QComboBox* createComboBoxFromPolyitem(PolyItem<T>& d, std::function<void(int)> s
return
combo
;
}
template
<
typename
B
,
typename
C
>
QComboBox
*
createComboBoxFromPolyPtr
(
PolyPtr
<
B
,
C
>&
d
,
std
::
function
<
void
(
int
)
>
slot
,
bool
inScrollArea
)
{
auto
*
combo
=
new
QComboBox
;
combo
->
addItems
(
d
.
menuEntries
());
combo
->
setMaxCount
(
d
.
menuEntries
().
size
());
combo
->
setToolTip
(
d
.
piTooltip
());
combo
->
setCurrentIndex
(
d
.
currentIndex
());
if
(
inScrollArea
)
WheelEventEater
::
install
(
combo
);
QObject
::
connect
(
combo
,
&
QComboBox
::
currentIndexChanged
,
[
&
d
,
slot
](
int
index
)
{
d
.
setCurrentIndex
(
index
);
if
(
slot
)
slot
(
index
);
});
return
combo
;
}
}
// namespace GUI::Util
#endif // BORNAGAIN_GUI_VIEW_NUMERIC_COMBOUTIL_H
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