From fc3b9fb23f39d9e032414d9b568991e2142ac109 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Wed, 30 Nov 2022 14:29:12 +0100
Subject: [PATCH 01/13] DistributionItems cleanup and /* decimal */ marks

---
 GUI/Model/Descriptor/DistributionItems.cpp   | 56 ++++++++++----------
 GUI/Model/Descriptor/DistributionItems.h     |  1 -
 GUI/Model/Device/BackgroundItems.cpp         |  2 +-
 GUI/Model/Device/BeamItems.cpp               |  2 +-
 GUI/Model/Device/FootprintItems.cpp          |  4 +-
 GUI/Model/Device/InstrumentItems.cpp         |  4 +-
 GUI/Model/Device/RectangularDetectorItem.cpp |  8 +--
 GUI/Model/Device/ResolutionFunctionItems.cpp |  4 +-
 8 files changed, 40 insertions(+), 41 deletions(-)

diff --git a/GUI/Model/Descriptor/DistributionItems.cpp b/GUI/Model/Descriptor/DistributionItems.cpp
index 686b879f7ee..033b3687a06 100644
--- a/GUI/Model/Descriptor/DistributionItems.cpp
+++ b/GUI/Model/Descriptor/DistributionItems.cpp
@@ -130,15 +130,15 @@ void DistributionNoneItem::initDistribution(double value)
 
 DoubleDescriptors DistributionNoneItem::distributionValues(bool withMean) const
 {
-    return withMean ? DoubleDescriptors{mean()} : DoubleDescriptors{};
+    return withMean ? DoubleDescriptors{m_mean} : DoubleDescriptors{};
 }
 
 // --------------------------------------------------------------------------------------------- //
 
 DistributionGateItem::DistributionGateItem()
 {
-    m_minimum.init("Min", "", 0.0, Unit::unitless, 3, RealLimits::limitless(), "min");
-    m_maximum.init("Max", "", 1.0, Unit::unitless, 3, RealLimits::limitless(), "max");
+    m_minimum.init("Min", "", 0.0, Unit::unitless, 3 /* decimals */, RealLimits::limitless(), "min");
+    m_maximum.init("Max", "", 1.0, Unit::unitless, 3 /* decimals */, RealLimits::limitless(), "max");
 }
 
 void DistributionGateItem::setUnit(const variant<QString, Unit>& unit)
@@ -149,7 +149,7 @@ void DistributionGateItem::setUnit(const variant<QString, Unit>& unit)
 
 std::unique_ptr<IDistribution1D> DistributionGateItem::createDistribution(double scale) const
 {
-    return std::make_unique<DistributionGate>(scale * m_minimum, scale * m_maximum);
+    return std::make_unique<DistributionGate>(scale * m_minimum.get(), scale * m_maximum.get());
 }
 
 void DistributionGateItem::initDistribution(double value)
@@ -197,13 +197,13 @@ void DistributionLorentzItem::setUnit(const variant<QString, Unit>& unit)
 
 std::unique_ptr<IDistribution1D> DistributionLorentzItem::createDistribution(double scale) const
 {
-    return std::make_unique<DistributionLorentz>(scale * m_mean, scale * m_hwhm);
+    return std::make_unique<DistributionLorentz>(scale * m_mean.get(), scale * m_hwhm.get());
 }
 
 std::unique_ptr<IRangedDistribution>
 DistributionLorentzItem::createIRangedDistribution(double scale) const
 {
-    return std::make_unique<RangedDistributionLorentz>(numberOfSamples(), sigmaFactor(),
+    return std::make_unique<RangedDistributionLorentz>(numberOfSamples(), m_sigmaFactor.get(),
                                                        m_limits.scaledLimits(scale));
 }
 
@@ -231,8 +231,8 @@ void DistributionLorentzItem::serialize(Streamer& s)
 
 DoubleDescriptors DistributionLorentzItem::distributionValues(bool withMean) const
 {
-    return withMean ? DoubleDescriptors{mean(), hwhm(), sigmaFactor()}
-                    : DoubleDescriptors{hwhm(), sigmaFactor()};
+    return withMean ? DoubleDescriptors{m_mean, m_hwhm, m_sigmaFactor}
+                    : DoubleDescriptors{m_hwhm, m_sigmaFactor};
 }
 
 // --------------------------------------------------------------------------------------------- //
@@ -242,7 +242,7 @@ DistributionGaussianItem::DistributionGaussianItem()
 {
     initSigmaFactor();
 
-    m_standardDeviation.init("StdDev", "", 1.0, Unit::unitless, 3, RealLimits::lowerLimited(0.0),
+    m_standardDeviation.init("StdDev", "", 1.0, Unit::unitless, 3 /* decimals */, RealLimits::lowerLimited(0.0),
                              "stdDev");
 }
 
@@ -254,19 +254,19 @@ void DistributionGaussianItem::setUnit(const variant<QString, Unit>& unit)
 
 std::unique_ptr<IDistribution1D> DistributionGaussianItem::createDistribution(double scale) const
 {
-    return std::make_unique<DistributionGaussian>(scale * m_mean, scale * m_standardDeviation);
+    return std::make_unique<DistributionGaussian>(scale * m_mean.get(), scale * m_standardDeviation.get());
 }
 
 std::unique_ptr<IRangedDistribution>
 DistributionGaussianItem::createIRangedDistribution(double scale) const
 {
-    return std::make_unique<RangedDistributionGaussian>(numberOfSamples(), sigmaFactor(),
+    return std::make_unique<RangedDistributionGaussian>(m_numberOfSamples, m_sigmaFactor.get(),
                                                         m_limits.scaledLimits(scale));
 }
 
 double DistributionGaussianItem::deviation(double scale) const
 {
-    return standardDeviation() * scale;
+    return m_standardDeviation.get() * scale;
 }
 
 void DistributionGaussianItem::initDistribution(double value)
@@ -287,8 +287,8 @@ void DistributionGaussianItem::serialize(Streamer& s)
 
 DoubleDescriptors DistributionGaussianItem::distributionValues(bool withMean) const
 {
-    return withMean ? DoubleDescriptors{mean(), standardDeviation(), sigmaFactor()}
-                    : DoubleDescriptors{standardDeviation(), sigmaFactor()};
+    return withMean ? DoubleDescriptors{m_mean, m_standardDeviation, m_sigmaFactor}
+                    : DoubleDescriptors{m_standardDeviation, m_sigmaFactor};
 }
 
 // --------------------------------------------------------------------------------------------- //
@@ -298,7 +298,7 @@ DistributionLogNormalItem::DistributionLogNormalItem()
     initSigmaFactor();
 
     m_median.init("Median", "", 1.0, Unit::unitless, "median");
-    m_scaleParameter.init("ScaleParameter", "", 1.0, Unit::unitless, 3,
+    m_scaleParameter.init("ScaleParameter", "", 1.0, Unit::unitless, 3 /* decimals */,
                           RealLimits::lowerLimited(0.0), "scalePar");
 }
 
@@ -309,7 +309,7 @@ void DistributionLogNormalItem::setUnit(const variant<QString, Unit>& unit)
 
 std::unique_ptr<IDistribution1D> DistributionLogNormalItem::createDistribution(double scale) const
 {
-    return std::make_unique<DistributionLogNormal>(scale * median(), scaleParameter());
+    return std::make_unique<DistributionLogNormal>(scale * m_median.get(), m_scaleParameter.get());
 }
 
 void DistributionLogNormalItem::initDistribution(double value)
@@ -331,7 +331,7 @@ void DistributionLogNormalItem::serialize(Streamer& s)
 
 DoubleDescriptors DistributionLogNormalItem::distributionValues(bool /*withMean*/) const
 {
-    return {median(), scaleParameter(), sigmaFactor()};
+    return {m_median, m_scaleParameter, m_sigmaFactor};
 }
 
 // --------------------------------------------------------------------------------------------- //
@@ -340,7 +340,7 @@ DistributionCosineItem::DistributionCosineItem()
     : SymmetricResolutionItem(1.0)
 {
     initSigmaFactor();
-    m_sigma.init("Sigma", "", 1.0, Unit::unitless, 3, RealLimits::lowerLimited(0.0), "sigma");
+    m_sigma.init("Sigma", "", 1.0, Unit::unitless, 3 /* decimals */, RealLimits::lowerLimited(0.0), "sigma");
 }
 
 void DistributionCosineItem::setUnit(const variant<QString, Unit>& unit)
@@ -351,19 +351,19 @@ void DistributionCosineItem::setUnit(const variant<QString, Unit>& unit)
 
 std::unique_ptr<IDistribution1D> DistributionCosineItem::createDistribution(double scale) const
 {
-    return std::make_unique<DistributionCosine>(scale * m_mean, scale * sigma());
+    return std::make_unique<DistributionCosine>(scale * m_mean.get(), scale * m_sigma.get());
 }
 
 std::unique_ptr<IRangedDistribution>
 DistributionCosineItem::createIRangedDistribution(double scale) const
 {
-    return std::make_unique<RangedDistributionCosine>(numberOfSamples(), sigmaFactor(),
+    return std::make_unique<RangedDistributionCosine>(m_numberOfSamples, m_sigmaFactor.get(),
                                                       m_limits.scaledLimits(scale));
 }
 
 double DistributionCosineItem::deviation(double scale) const
 {
-    return sigma() * scale;
+    return m_sigma.get() * scale;
 }
 
 void DistributionCosineItem::initDistribution(double value)
@@ -384,15 +384,15 @@ void DistributionCosineItem::serialize(Streamer& s)
 
 DoubleDescriptors DistributionCosineItem::distributionValues(bool withMean) const
 {
-    return withMean ? DoubleDescriptors{mean(), sigma(), sigmaFactor()}
-                    : DoubleDescriptors{sigma(), sigmaFactor()};
+    return withMean ? DoubleDescriptors{m_mean, m_sigma, m_sigmaFactor}
+                    : DoubleDescriptors{m_sigma, m_sigmaFactor};
 }
 
 // --------------------------------------------------------------------------------------------- //
 
 DistributionTrapezoidItem::DistributionTrapezoidItem()
 {
-    m_center.init("Center", "", 1.0, Unit::unitless, 3, RealLimits::limitless(), "center");
+    m_center.init("Center", "", 1.0, Unit::unitless, 3 /* decimals */, RealLimits::limitless(), "center");
     m_leftWidth.init("LeftWidth", "", 1.0, Unit::unitless, "left");
     m_middleWidth.init("MiddleWidth", "", 1.0, Unit::unitless, "middle");
     m_rightWidth.init("RightWidth", "", 1.0, Unit::unitless, "right");
@@ -408,8 +408,8 @@ void DistributionTrapezoidItem::setUnit(const variant<QString, Unit>& unit)
 
 std::unique_ptr<IDistribution1D> DistributionTrapezoidItem::createDistribution(double scale) const
 {
-    return std::make_unique<DistributionTrapezoid>(scale * center(), scale * leftWidth(),
-                                                   scale * middleWidth(), scale * rightWidth());
+    return std::make_unique<DistributionTrapezoid>(scale * m_center.get(), scale * m_leftWidth.get(),
+                                                   scale * m_middleWidth.get(), scale * m_rightWidth.get());
 }
 
 void DistributionTrapezoidItem::initDistribution(double value)
@@ -434,6 +434,6 @@ void DistributionTrapezoidItem::serialize(Streamer& s)
 
 DoubleDescriptors DistributionTrapezoidItem::distributionValues(bool withMean) const
 {
-    return withMean ? DoubleDescriptors{center(), leftWidth(), middleWidth(), rightWidth()}
-                    : DoubleDescriptors{leftWidth(), middleWidth(), rightWidth()};
+    return withMean ? DoubleDescriptors{m_center, m_leftWidth, m_middleWidth, m_rightWidth}
+                    : DoubleDescriptors{m_leftWidth, m_middleWidth, m_rightWidth};
 }
diff --git a/GUI/Model/Descriptor/DistributionItems.h b/GUI/Model/Descriptor/DistributionItems.h
index fafafe4b06f..d9d22b1d35d 100644
--- a/GUI/Model/Descriptor/DistributionItems.h
+++ b/GUI/Model/Descriptor/DistributionItems.h
@@ -63,7 +63,6 @@ protected:
 
     RealLimits m_limits;
 
-private:
     uint m_numberOfSamples = 5;
 };
 
diff --git a/GUI/Model/Device/BackgroundItems.cpp b/GUI/Model/Device/BackgroundItems.cpp
index 342e93687cc..0fde80c720e 100644
--- a/GUI/Model/Device/BackgroundItems.cpp
+++ b/GUI/Model/Device/BackgroundItems.cpp
@@ -28,7 +28,7 @@ const QString BackgroundValue("BackgroundValue");
 
 ConstantBackgroundItem::ConstantBackgroundItem()
 {
-    m_backgroundValue.init("Background value", "Constant background value", 0.0, "counts/pixel", 3,
+    m_backgroundValue.init("Background value", "Constant background value", 0.0, "counts/pixel", 3 /* decimals */,
                            RealLimits::nonnegative(), "value");
 }
 
diff --git a/GUI/Model/Device/BeamItems.cpp b/GUI/Model/Device/BeamItems.cpp
index 71c9993076d..e9656771061 100644
--- a/GUI/Model/Device/BeamItems.cpp
+++ b/GUI/Model/Device/BeamItems.cpp
@@ -49,7 +49,7 @@ RealLimits getLimits(double max_q)
 BeamItem::BeamItem()
 {
     m_intensity.init("Intensity", "Beam intensity in neutrons (or gammas) per sec.", 1e+08,
-                     Unit::unitless, 3, RealLimits::limited(0.0, 1e+32), "intensity");
+                     Unit::unitless, 3 /* decimals */, RealLimits::limited(0.0, 1e+32), "intensity");
 
     m_azimuthalAngleItem.reset(new BeamAzimuthalAngleItem());
 }
diff --git a/GUI/Model/Device/FootprintItems.cpp b/GUI/Model/Device/FootprintItems.cpp
index 323b599fdce..9672114aee0 100644
--- a/GUI/Model/Device/FootprintItems.cpp
+++ b/GUI/Model/Device/FootprintItems.cpp
@@ -34,7 +34,7 @@ std::unique_ptr<IFootprintFactor> FootprintNoneItem::createFootprint() const
 FootprintGaussianItem::FootprintGaussianItem(double value)
 {
     m_gaussianFootprintValue.init("Width ratio", "The ratio of beam and sample full widths", value,
-                                  Unit::unitless, 3, RealLimits::nonnegative(), "ratio");
+                                  Unit::unitless, 3 /* decimals */, RealLimits::nonnegative(), "ratio");
 }
 
 void FootprintGaussianItem::serialize(Streamer& s)
@@ -51,7 +51,7 @@ std::unique_ptr<IFootprintFactor> FootprintGaussianItem::createFootprint() const
 FootprintSquareItem::FootprintSquareItem(double value)
 {
     m_squareFootprintValue.init("Width ratio", "The ratio of beam and sample full widths", value,
-                                Unit::unitless, 3, RealLimits::nonnegative(), "ratio");
+                                Unit::unitless, 3 /* decimals */, RealLimits::nonnegative(), "ratio");
 }
 
 void FootprintSquareItem::serialize(Streamer& s)
diff --git a/GUI/Model/Device/InstrumentItems.cpp b/GUI/Model/Device/InstrumentItems.cpp
index 6dea79c3835..685d37ee0f3 100644
--- a/GUI/Model/Device/InstrumentItems.cpp
+++ b/GUI/Model/Device/InstrumentItems.cpp
@@ -75,10 +75,10 @@ InstrumentItem::InstrumentItem()
 {
     m_id = QUuid::createUuid().toString();
     m_analyzerEfficiency.init("Analyzer efficiency", "Efficiency of the polarization analysis", 0.0,
-                              Unit::unitless, 4, RealLimits::limitless(), "efficiency");
+                              Unit::unitless, 4 /* decimals */, RealLimits::limitless(), "efficiency");
     m_analyzerTotalTransmission.init("Analyzer transmission",
                                      "Total transmission of the polarization analysis", 1.0,
-                                     Unit::unitless, 4, RealLimits::nonnegative(), "transmission");
+                                     Unit::unitless, 4 /* decimals */, RealLimits::nonnegative(), "transmission");
     m_polarization.init("Polarization (Bloch vector)",
                         "Polarization of the beam, given as the Bloch vector", Unit::unitless,
                         "polarization");
diff --git a/GUI/Model/Device/RectangularDetectorItem.cpp b/GUI/Model/Device/RectangularDetectorItem.cpp
index c316c42212d..97b8e327ced 100644
--- a/GUI/Model/Device/RectangularDetectorItem.cpp
+++ b/GUI/Model/Device/RectangularDetectorItem.cpp
@@ -86,9 +86,9 @@ RectangularDetectorItem::RectangularDetectorItem()
 
     m_xSize = 100;
     m_ySize = 100;
-    m_width.init("Width (x-axis)", "Width of the detector", default_detector_width, "mm", 3,
+    m_width.init("Width (x-axis)", "Width of the detector", default_detector_width, "mm", 3 /* decimals */,
                  RealLimits::positive(), "width");
-    m_height.init("Height (y-axis)", "Height of the detector", default_detector_height, "mm", 3,
+    m_height.init("Height (y-axis)", "Height of the detector", default_detector_height, "mm", 3 /* decimals */,
                   RealLimits::positive(), "height");
 
     m_normalVector.init(
@@ -101,8 +101,8 @@ RectangularDetectorItem::RectangularDetectorItem()
                            Unit::unitless, "directionVector");
     m_directionVector.setY(-1.0);
 
-    m_u0.init("u0", "", default_detector_width / 2., "mm", 3, RealLimits::limitless(), "u0");
-    m_v0.init("v0", "", 0.0, "mm", 3, RealLimits::limitless(), "v0");
+    m_u0.init("u0", "", default_detector_width / 2., "mm", 3 /* decimals */, RealLimits::limitless(), "u0");
+    m_v0.init("v0", "", 0.0, "mm", 3 /* decimals */, RealLimits::limitless(), "v0");
     m_distance.init("Distance", "Distance from the sample origin to the detector plane",
                     default_detector_distance, "mm", "distance");
 
diff --git a/GUI/Model/Device/ResolutionFunctionItems.cpp b/GUI/Model/Device/ResolutionFunctionItems.cpp
index 3741fd4326d..bb73ccd3e26 100644
--- a/GUI/Model/Device/ResolutionFunctionItems.cpp
+++ b/GUI/Model/Device/ResolutionFunctionItems.cpp
@@ -33,9 +33,9 @@ ResolutionFunctionNoneItem::createResolutionFunction(double) const
 
 ResolutionFunction2DGaussianItem::ResolutionFunction2DGaussianItem()
 {
-    m_sigmaX.init("Sigma X", "Resolution along horizontal axis", 0.02, Unit::degree, 3,
+    m_sigmaX.init("Sigma X", "Resolution along horizontal axis", 0.02, Unit::degree, 3 /* decimals */,
                   RealLimits::lowerLimited(0.0), "sigmaX");
-    m_sigmaY.init("Sigma Y", "Resolution along vertical axis", 0.02, Unit::degree, 3,
+    m_sigmaY.init("Sigma Y", "Resolution along vertical axis", 0.02, Unit::degree, 3 /* decimals */,
                   RealLimits::lowerLimited(0.0), "sigmaY");
 }
 
-- 
GitLab


From 41bd19b32a83898f5a1eeccf44ebb7e43fa25eb4 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Wed, 30 Nov 2022 14:50:24 +0100
Subject: [PATCH 02/13] VectorProperty: DoubleProperty x/y/z interfaces

---
 GUI/Model/Descriptor/DistributionItems.cpp    | 24 ++++++++++++-------
 GUI/Model/Descriptor/VectorProperty.h         | 11 ++++++---
 GUI/Model/Device/BackgroundItems.cpp          |  4 ++--
 GUI/Model/Device/BeamItems.cpp                |  3 ++-
 GUI/Model/Device/FootprintItems.cpp           |  6 +++--
 GUI/Model/Device/InstrumentItems.cpp          |  9 +++----
 GUI/Model/Device/RectangularDetectorItem.cpp  | 11 +++++----
 GUI/Model/Device/ResolutionFunctionItems.cpp  |  4 ++--
 .../MaterialEditor/MaterialEditorDialog.cpp   |  6 ++---
 .../MaterialEditor/MaterialEditorModel.cpp    |  8 +++----
 10 files changed, 51 insertions(+), 35 deletions(-)

diff --git a/GUI/Model/Descriptor/DistributionItems.cpp b/GUI/Model/Descriptor/DistributionItems.cpp
index 033b3687a06..ef842298c8d 100644
--- a/GUI/Model/Descriptor/DistributionItems.cpp
+++ b/GUI/Model/Descriptor/DistributionItems.cpp
@@ -137,8 +137,10 @@ DoubleDescriptors DistributionNoneItem::distributionValues(bool withMean) const
 
 DistributionGateItem::DistributionGateItem()
 {
-    m_minimum.init("Min", "", 0.0, Unit::unitless, 3 /* decimals */, RealLimits::limitless(), "min");
-    m_maximum.init("Max", "", 1.0, Unit::unitless, 3 /* decimals */, RealLimits::limitless(), "max");
+    m_minimum.init("Min", "", 0.0, Unit::unitless, 3 /* decimals */, RealLimits::limitless(),
+                   "min");
+    m_maximum.init("Max", "", 1.0, Unit::unitless, 3 /* decimals */, RealLimits::limitless(),
+                   "max");
 }
 
 void DistributionGateItem::setUnit(const variant<QString, Unit>& unit)
@@ -242,8 +244,8 @@ DistributionGaussianItem::DistributionGaussianItem()
 {
     initSigmaFactor();
 
-    m_standardDeviation.init("StdDev", "", 1.0, Unit::unitless, 3 /* decimals */, RealLimits::lowerLimited(0.0),
-                             "stdDev");
+    m_standardDeviation.init("StdDev", "", 1.0, Unit::unitless, 3 /* decimals */,
+                             RealLimits::lowerLimited(0.0), "stdDev");
 }
 
 void DistributionGaussianItem::setUnit(const variant<QString, Unit>& unit)
@@ -254,7 +256,8 @@ void DistributionGaussianItem::setUnit(const variant<QString, Unit>& unit)
 
 std::unique_ptr<IDistribution1D> DistributionGaussianItem::createDistribution(double scale) const
 {
-    return std::make_unique<DistributionGaussian>(scale * m_mean.get(), scale * m_standardDeviation.get());
+    return std::make_unique<DistributionGaussian>(scale * m_mean.get(),
+                                                  scale * m_standardDeviation.get());
 }
 
 std::unique_ptr<IRangedDistribution>
@@ -340,7 +343,8 @@ DistributionCosineItem::DistributionCosineItem()
     : SymmetricResolutionItem(1.0)
 {
     initSigmaFactor();
-    m_sigma.init("Sigma", "", 1.0, Unit::unitless, 3 /* decimals */, RealLimits::lowerLimited(0.0), "sigma");
+    m_sigma.init("Sigma", "", 1.0, Unit::unitless, 3 /* decimals */, RealLimits::lowerLimited(0.0),
+                 "sigma");
 }
 
 void DistributionCosineItem::setUnit(const variant<QString, Unit>& unit)
@@ -392,7 +396,8 @@ DoubleDescriptors DistributionCosineItem::distributionValues(bool withMean) cons
 
 DistributionTrapezoidItem::DistributionTrapezoidItem()
 {
-    m_center.init("Center", "", 1.0, Unit::unitless, 3 /* decimals */, RealLimits::limitless(), "center");
+    m_center.init("Center", "", 1.0, Unit::unitless, 3 /* decimals */, RealLimits::limitless(),
+                  "center");
     m_leftWidth.init("LeftWidth", "", 1.0, Unit::unitless, "left");
     m_middleWidth.init("MiddleWidth", "", 1.0, Unit::unitless, "middle");
     m_rightWidth.init("RightWidth", "", 1.0, Unit::unitless, "right");
@@ -408,8 +413,9 @@ void DistributionTrapezoidItem::setUnit(const variant<QString, Unit>& unit)
 
 std::unique_ptr<IDistribution1D> DistributionTrapezoidItem::createDistribution(double scale) const
 {
-    return std::make_unique<DistributionTrapezoid>(scale * m_center.get(), scale * m_leftWidth.get(),
-                                                   scale * m_middleWidth.get(), scale * m_rightWidth.get());
+    return std::make_unique<DistributionTrapezoid>(
+        scale * m_center.get(), scale * m_leftWidth.get(), scale * m_middleWidth.get(),
+        scale * m_rightWidth.get());
 }
 
 void DistributionTrapezoidItem::initDistribution(double value)
diff --git a/GUI/Model/Descriptor/VectorProperty.h b/GUI/Model/Descriptor/VectorProperty.h
index c869bb9714b..7062c9e2591 100644
--- a/GUI/Model/Descriptor/VectorProperty.h
+++ b/GUI/Model/Descriptor/VectorProperty.h
@@ -57,9 +57,14 @@ public:
 
     void rwProperty(Streamer& s, const QString& tag);
 
-    DoubleDescriptor x() const { return m_x; }
-    DoubleDescriptor y() const { return m_y; }
-    DoubleDescriptor z() const { return m_z; }
+    DoubleProperty& x() { return m_x; }
+    const DoubleProperty& x() const { return m_x; }
+
+    DoubleProperty& y() { return m_y; }
+    const DoubleProperty& y() const { return m_y; }
+
+    DoubleProperty& z() { return m_z; }
+    const DoubleProperty& z() const { return m_z; }
 
 private:
     QString m_uid; //!< Unique id of this vector property.
diff --git a/GUI/Model/Device/BackgroundItems.cpp b/GUI/Model/Device/BackgroundItems.cpp
index 0fde80c720e..49f33ae193b 100644
--- a/GUI/Model/Device/BackgroundItems.cpp
+++ b/GUI/Model/Device/BackgroundItems.cpp
@@ -28,8 +28,8 @@ const QString BackgroundValue("BackgroundValue");
 
 ConstantBackgroundItem::ConstantBackgroundItem()
 {
-    m_backgroundValue.init("Background value", "Constant background value", 0.0, "counts/pixel", 3 /* decimals */,
-                           RealLimits::nonnegative(), "value");
+    m_backgroundValue.init("Background value", "Constant background value", 0.0, "counts/pixel",
+                           3 /* decimals */, RealLimits::nonnegative(), "value");
 }
 
 std::unique_ptr<IBackground> ConstantBackgroundItem::createBackground() const
diff --git a/GUI/Model/Device/BeamItems.cpp b/GUI/Model/Device/BeamItems.cpp
index e9656771061..58f4b0b3d41 100644
--- a/GUI/Model/Device/BeamItems.cpp
+++ b/GUI/Model/Device/BeamItems.cpp
@@ -49,7 +49,8 @@ RealLimits getLimits(double max_q)
 BeamItem::BeamItem()
 {
     m_intensity.init("Intensity", "Beam intensity in neutrons (or gammas) per sec.", 1e+08,
-                     Unit::unitless, 3 /* decimals */, RealLimits::limited(0.0, 1e+32), "intensity");
+                     Unit::unitless, 3 /* decimals */, RealLimits::limited(0.0, 1e+32),
+                     "intensity");
 
     m_azimuthalAngleItem.reset(new BeamAzimuthalAngleItem());
 }
diff --git a/GUI/Model/Device/FootprintItems.cpp b/GUI/Model/Device/FootprintItems.cpp
index 9672114aee0..454bba5b0c1 100644
--- a/GUI/Model/Device/FootprintItems.cpp
+++ b/GUI/Model/Device/FootprintItems.cpp
@@ -34,7 +34,8 @@ std::unique_ptr<IFootprintFactor> FootprintNoneItem::createFootprint() const
 FootprintGaussianItem::FootprintGaussianItem(double value)
 {
     m_gaussianFootprintValue.init("Width ratio", "The ratio of beam and sample full widths", value,
-                                  Unit::unitless, 3 /* decimals */, RealLimits::nonnegative(), "ratio");
+                                  Unit::unitless, 3 /* decimals */, RealLimits::nonnegative(),
+                                  "ratio");
 }
 
 void FootprintGaussianItem::serialize(Streamer& s)
@@ -51,7 +52,8 @@ std::unique_ptr<IFootprintFactor> FootprintGaussianItem::createFootprint() const
 FootprintSquareItem::FootprintSquareItem(double value)
 {
     m_squareFootprintValue.init("Width ratio", "The ratio of beam and sample full widths", value,
-                                Unit::unitless, 3 /* decimals */, RealLimits::nonnegative(), "ratio");
+                                Unit::unitless, 3 /* decimals */, RealLimits::nonnegative(),
+                                "ratio");
 }
 
 void FootprintSquareItem::serialize(Streamer& s)
diff --git a/GUI/Model/Device/InstrumentItems.cpp b/GUI/Model/Device/InstrumentItems.cpp
index 685d37ee0f3..b8a3e168530 100644
--- a/GUI/Model/Device/InstrumentItems.cpp
+++ b/GUI/Model/Device/InstrumentItems.cpp
@@ -75,10 +75,11 @@ InstrumentItem::InstrumentItem()
 {
     m_id = QUuid::createUuid().toString();
     m_analyzerEfficiency.init("Analyzer efficiency", "Efficiency of the polarization analysis", 0.0,
-                              Unit::unitless, 4 /* decimals */, RealLimits::limitless(), "efficiency");
-    m_analyzerTotalTransmission.init("Analyzer transmission",
-                                     "Total transmission of the polarization analysis", 1.0,
-                                     Unit::unitless, 4 /* decimals */, RealLimits::nonnegative(), "transmission");
+                              Unit::unitless, 4 /* decimals */, RealLimits::limitless(),
+                              "efficiency");
+    m_analyzerTotalTransmission.init(
+        "Analyzer transmission", "Total transmission of the polarization analysis", 1.0,
+        Unit::unitless, 4 /* decimals */, RealLimits::nonnegative(), "transmission");
     m_polarization.init("Polarization (Bloch vector)",
                         "Polarization of the beam, given as the Bloch vector", Unit::unitless,
                         "polarization");
diff --git a/GUI/Model/Device/RectangularDetectorItem.cpp b/GUI/Model/Device/RectangularDetectorItem.cpp
index 97b8e327ced..7b423ed024b 100644
--- a/GUI/Model/Device/RectangularDetectorItem.cpp
+++ b/GUI/Model/Device/RectangularDetectorItem.cpp
@@ -86,10 +86,10 @@ RectangularDetectorItem::RectangularDetectorItem()
 
     m_xSize = 100;
     m_ySize = 100;
-    m_width.init("Width (x-axis)", "Width of the detector", default_detector_width, "mm", 3 /* decimals */,
-                 RealLimits::positive(), "width");
-    m_height.init("Height (y-axis)", "Height of the detector", default_detector_height, "mm", 3 /* decimals */,
-                  RealLimits::positive(), "height");
+    m_width.init("Width (x-axis)", "Width of the detector", default_detector_width, "mm",
+                 3 /* decimals */, RealLimits::positive(), "width");
+    m_height.init("Height (y-axis)", "Height of the detector", default_detector_height, "mm",
+                  3 /* decimals */, RealLimits::positive(), "height");
 
     m_normalVector.init(
         "Normal vector",
@@ -101,7 +101,8 @@ RectangularDetectorItem::RectangularDetectorItem()
                            Unit::unitless, "directionVector");
     m_directionVector.setY(-1.0);
 
-    m_u0.init("u0", "", default_detector_width / 2., "mm", 3 /* decimals */, RealLimits::limitless(), "u0");
+    m_u0.init("u0", "", default_detector_width / 2., "mm", 3 /* decimals */,
+              RealLimits::limitless(), "u0");
     m_v0.init("v0", "", 0.0, "mm", 3 /* decimals */, RealLimits::limitless(), "v0");
     m_distance.init("Distance", "Distance from the sample origin to the detector plane",
                     default_detector_distance, "mm", "distance");
diff --git a/GUI/Model/Device/ResolutionFunctionItems.cpp b/GUI/Model/Device/ResolutionFunctionItems.cpp
index bb73ccd3e26..bd7d1416104 100644
--- a/GUI/Model/Device/ResolutionFunctionItems.cpp
+++ b/GUI/Model/Device/ResolutionFunctionItems.cpp
@@ -33,8 +33,8 @@ ResolutionFunctionNoneItem::createResolutionFunction(double) const
 
 ResolutionFunction2DGaussianItem::ResolutionFunction2DGaussianItem()
 {
-    m_sigmaX.init("Sigma X", "Resolution along horizontal axis", 0.02, Unit::degree, 3 /* decimals */,
-                  RealLimits::lowerLimited(0.0), "sigmaX");
+    m_sigmaX.init("Sigma X", "Resolution along horizontal axis", 0.02, Unit::degree,
+                  3 /* decimals */, RealLimits::lowerLimited(0.0), "sigmaX");
     m_sigmaY.init("Sigma Y", "Resolution along vertical axis", 0.02, Unit::degree, 3 /* decimals */,
                   RealLimits::lowerLimited(0.0), "sigmaY");
 }
diff --git a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp
index 129270fe5b3..bc99c21b464 100644
--- a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp
+++ b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp
@@ -255,9 +255,9 @@ void MaterialEditorDialog::fill()
         m_ui->imaginaryEdit->setText(QString::number(materialItem->sldIm().get(), 'g'));
     }
 
-    m_ui->xSpinBox->setValue(materialItem->magnetization().x());
-    m_ui->ySpinBox->setValue(materialItem->magnetization().y());
-    m_ui->zSpinBox->setValue(materialItem->magnetization().z());
+    m_ui->xSpinBox->setValue(materialItem->magnetization().r3().x());
+    m_ui->ySpinBox->setValue(materialItem->magnetization().r3().y());
+    m_ui->zSpinBox->setValue(materialItem->magnetization().r3().z());
 }
 
 void MaterialEditorDialog::setCurrentMaterial(const MaterialItem* m)
diff --git a/GUI/View/MaterialEditor/MaterialEditorModel.cpp b/GUI/View/MaterialEditor/MaterialEditorModel.cpp
index 907a59115f0..f5436c4ca8e 100644
--- a/GUI/View/MaterialEditor/MaterialEditorModel.cpp
+++ b/GUI/View/MaterialEditor/MaterialEditorModel.cpp
@@ -60,7 +60,7 @@ QVariant MaterialEditorModel::data(const QModelIndex& index, int role /*= Qt::Di
     if (!index.isValid())
         return {};
 
-    MaterialItem* material = m_model->materialItems()[index.row()];
+    const MaterialItem* material = m_model->materialItems()[index.row()];
 
     if (role == Qt::DisplayRole) {
         switch (index.column()) {
@@ -78,9 +78,9 @@ QVariant MaterialEditorModel::data(const QModelIndex& index, int role /*= Qt::Di
 
         case MAGNETIZATION:
             return QString("%1/%2/%3")
-                .arg(material->magnetization().x())
-                .arg(material->magnetization().y())
-                .arg(material->magnetization().z());
+                .arg(material->magnetization().r3().x())
+                .arg(material->magnetization().r3().y())
+                .arg(material->magnetization().r3().z());
         }
     } else if (role == Qt::DecorationRole) {
         switch (index.column()) {
-- 
GitLab


From 06665bde582d2dbfc6bc0200c5ebe44d82af11b2 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Wed, 30 Nov 2022 14:54:36 +0100
Subject: [PATCH 03/13] mv DoubleDescriptors to DoubleProperty

---
 GUI/Model/Descriptor/DoubleDescriptor.h    | 3 ---
 GUI/Model/Descriptor/DoubleProperty.h      | 2 ++
 GUI/View/SampleDesigner/LayerEditorUtils.h | 6 +++---
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/GUI/Model/Descriptor/DoubleDescriptor.h b/GUI/Model/Descriptor/DoubleDescriptor.h
index 16d5b0c3963..eb24549e343 100644
--- a/GUI/Model/Descriptor/DoubleDescriptor.h
+++ b/GUI/Model/Descriptor/DoubleDescriptor.h
@@ -85,7 +85,4 @@ public:
         nullptr; //!< Path describing this value. Used e.g. for undo/redo
 };
 
-using DoubleDescriptors = QList<DoubleDescriptor>;
-
-
 #endif // BORNAGAIN_GUI_MODEL_DESCRIPTOR_DOUBLEDESCRIPTOR_H
diff --git a/GUI/Model/Descriptor/DoubleProperty.h b/GUI/Model/Descriptor/DoubleProperty.h
index 2168c053c3b..c44ee6998bd 100644
--- a/GUI/Model/Descriptor/DoubleProperty.h
+++ b/GUI/Model/Descriptor/DoubleProperty.h
@@ -120,4 +120,6 @@ public:                                                                 \
 
 // clang-format on
 
+using DoubleDescriptors = QList<DoubleDescriptor>;
+
 #endif // BORNAGAIN_GUI_MODEL_DESCRIPTOR_DOUBLEPROPERTY_H
diff --git a/GUI/View/SampleDesigner/LayerEditorUtils.h b/GUI/View/SampleDesigner/LayerEditorUtils.h
index 25854f96b22..54462cadcbb 100644
--- a/GUI/View/SampleDesigner/LayerEditorUtils.h
+++ b/GUI/View/SampleDesigner/LayerEditorUtils.h
@@ -15,7 +15,7 @@
 #ifndef BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYEREDITORUTILS_H
 #define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYEREDITORUTILS_H
 
-#include "GUI/Model/Descriptor/DoubleDescriptor.h"
+#include "GUI/Model/Descriptor/DoubleProperty.h"
 
 #include "GUI/Model/CatSample/FormFactorItemCatalog.h"
 #include "GUI/Model/CatSample/ItemWithParticlesCatalog.h"
@@ -24,10 +24,11 @@
 #include <functional>
 
 class DoubleSpinBox;
-class Profile1DItem;
 class FormFactorItem;
 class ItemWithParticles;
 class LayerBasicRoughnessItem;
+class Profile1DItem;
+class Profile2DItem;
 class QGridLayout;
 class QLabel;
 class QPushButton;
@@ -36,7 +37,6 @@ class QWidget;
 class RotationItem;
 class SampleEditorController;
 class VectorProperty;
-class Profile2DItem;
 
 //! Utility functions to support layer oriented sample editor
 namespace LayerEditorUtils {
-- 
GitLab


From 79488ad8fc5a62a33a54ef4a5e2cdae553b0d687 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Wed, 30 Nov 2022 15:04:20 +0100
Subject: [PATCH 04/13] ProfileItems & RotationItems: return non-const list of
 descriptors

---
 GUI/Model/Model/ParameterTreeUtils.cpp     | 16 ++++++++--------
 GUI/Model/Sample/ProfileItems.cpp          |  8 ++++----
 GUI/Model/Sample/ProfileItems.h            |  8 ++++----
 GUI/Model/Sample/RotationItems.h           |  6 +++---
 GUI/View/SampleDesigner/LayerEditorUtils.h |  1 -
 5 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/GUI/Model/Model/ParameterTreeUtils.cpp b/GUI/Model/Model/ParameterTreeUtils.cpp
index 3522450bdb5..96d528040b1 100644
--- a/GUI/Model/Model/ParameterTreeUtils.cpp
+++ b/GUI/Model/Model/ParameterTreeUtils.cpp
@@ -188,9 +188,9 @@ void ParameterTreeBuilder::addInterference(ParameterLabelItem* layoutLabel,
         addParameterItem(label, itf->domainSize());
         addParameterItem(label, itf->kappa());
 
-        const auto* pdf = itf->probabilityDistribution().currentItem();
+        auto* pdf = itf->probabilityDistribution().currentItem();
         auto* pdfLabel = addLabel<Profile1DItemCatalog>(label, "PDF", pdf);
-        for (const auto& d : pdf->valueDescriptors())
+        for (auto& d : pdf->valueDescriptors())
             addParameterItem(pdfLabel, d);
     } else if (const auto* itf = dynamic_cast<const Interference2DParacrystalItem*>(interference)) {
         addParameterItem(label, itf->positionVariance());
@@ -199,8 +199,8 @@ void ParameterTreeBuilder::addInterference(ParameterLabelItem* layoutLabel,
         addParameterItem(label, itf->domainSize2());
         addLattice(label, itf);
 
-        const auto* pdf1 = itf->probabilityDistribution1().currentItem();
-        const auto* pdf2 = itf->probabilityDistribution2().currentItem();
+        auto* pdf1 = itf->probabilityDistribution1().currentItem();
+        auto* pdf2 = itf->probabilityDistribution2().currentItem();
         const bool samePdfTypes =
             Profile2DItemCatalog::type(pdf1) == Profile2DItemCatalog::type(pdf2);
         auto* pdf1Label =
@@ -216,7 +216,7 @@ void ParameterTreeBuilder::addInterference(ParameterLabelItem* layoutLabel,
         addParameterItem(label, itf->length());
         addParameterItem(label, itf->rotationAngle());
 
-        const auto* df = itf->decayFunction().currentItem();
+        auto* df = itf->decayFunction().currentItem();
         auto* dfLabel = addLabel<Profile1DItemCatalog>(label, "Decay function", df);
         for (const auto& d : df->valueDescriptors())
             addParameterItem(dfLabel, d);
@@ -224,7 +224,7 @@ void ParameterTreeBuilder::addInterference(ParameterLabelItem* layoutLabel,
         addParameterItem(label, itf->positionVariance());
         addLattice(label, itf);
 
-        const auto* df = itf->decayFunction().currentItem();
+        auto* df = itf->decayFunction().currentItem();
         auto* dfLabel = addLabel<Profile2DItemCatalog>(label, "Decay function", df);
         for (const auto& d : df->valueDescriptors())
             addParameterItem(dfLabel, d);
@@ -296,12 +296,12 @@ void ParameterTreeBuilder::addLattice(ParameterLabelItem* parentLabel,
 
 void ParameterTreeBuilder::addRotation(ParameterLabelItem* parentLabel, ItemWithParticles* p)
 {
-    const auto* r = p->rotation().currentItem();
+    auto* r = p->rotation().currentItem();
     if (!r)
         return;
 
     auto* label = addLabel<RotationItemCatalog>(parentLabel, "Rotation", r);
-    for (const auto& d : r->rotationValues())
+    for (auto& d : r->rotationValues())
         addParameterItem(label, d);
 }
 
diff --git a/GUI/Model/Sample/ProfileItems.cpp b/GUI/Model/Sample/ProfileItems.cpp
index 7c87cf415d7..df0c4293541 100644
--- a/GUI/Model/Sample/ProfileItems.cpp
+++ b/GUI/Model/Sample/ProfileItems.cpp
@@ -39,7 +39,7 @@ void Profile1DItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Omega, m_omega);
 }
 
-DoubleDescriptors Profile1DItem::valueDescriptors() const
+DoubleDescriptors Profile1DItem::valueDescriptors()
 {
     return {m_omega};
 }
@@ -99,7 +99,7 @@ void Profile1DVoigtItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Eta, m_eta);
 }
 
-DoubleDescriptors Profile1DVoigtItem::valueDescriptors() const
+DoubleDescriptors Profile1DVoigtItem::valueDescriptors()
 {
     return Profile1DItem::valueDescriptors() + DoubleDescriptors{m_eta};
 }
@@ -126,7 +126,7 @@ void Profile2DItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Gamma, m_gamma);
 }
 
-DoubleDescriptors Profile2DItem::valueDescriptors() const
+DoubleDescriptors Profile2DItem::valueDescriptors()
 {
     return {m_omegaX, m_omegaY, m_gamma};
 }
@@ -186,7 +186,7 @@ void Profile2DVoigtItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Eta, m_eta);
 }
 
-DoubleDescriptors Profile2DVoigtItem::valueDescriptors() const
+DoubleDescriptors Profile2DVoigtItem::valueDescriptors()
 {
     return {m_omegaX, m_omegaY, m_eta, m_gamma};
 }
diff --git a/GUI/Model/Sample/ProfileItems.h b/GUI/Model/Sample/ProfileItems.h
index 648317a1326..efef7dbf93a 100644
--- a/GUI/Model/Sample/ProfileItems.h
+++ b/GUI/Model/Sample/ProfileItems.h
@@ -33,7 +33,7 @@ public:
     double omega() const { return m_omega.get(); }
     void setOmega(double v) { m_omega.set(v); }
 
-    virtual DoubleDescriptors valueDescriptors() const;
+    virtual DoubleDescriptors valueDescriptors();
 
 protected:
     Profile1DItem();
@@ -74,7 +74,7 @@ public:
 
     void setEta(double v) { m_eta.set(v); }
 
-    DoubleDescriptors valueDescriptors() const override;
+    DoubleDescriptors valueDescriptors() override;
 
 private:
     DoubleProperty m_eta;
@@ -92,7 +92,7 @@ public:
     void setOmegaY(double v) { m_omegaY.set(v); }
     void setGamma(double v) { m_gamma.set(v); }
 
-    virtual DoubleDescriptors valueDescriptors() const;
+    virtual DoubleDescriptors valueDescriptors();
 
 protected:
     Profile2DItem();
@@ -130,7 +130,7 @@ public:
 
     void setEta(double v) { m_eta.set(v); }
 
-    DoubleDescriptors valueDescriptors() const override;
+    DoubleDescriptors valueDescriptors() override;
 
 private:
     DoubleProperty m_eta;
diff --git a/GUI/Model/Sample/RotationItems.h b/GUI/Model/Sample/RotationItems.h
index 96dc05fd3ba..81762926005 100644
--- a/GUI/Model/Sample/RotationItems.h
+++ b/GUI/Model/Sample/RotationItems.h
@@ -29,7 +29,7 @@ public:
     RotMatrix rotation() const;
 
     virtual void serialize(Streamer& s) = 0;
-    virtual DoubleDescriptors rotationValues() const = 0;
+    virtual DoubleDescriptors rotationValues() = 0;
 
 protected:
     RotationItem();
@@ -39,7 +39,7 @@ protected:
 class XYZRotationItem : public RotationItem {
 public:
     void serialize(Streamer& s) override;
-    DoubleDescriptors rotationValues() const override { return {m_angle}; };
+    DoubleDescriptors rotationValues() override { return {m_angle}; };
 
     void setAngle(double v) { m_angle.set(v); }
 
@@ -75,7 +75,7 @@ class EulerRotationItem : public RotationItem {
 public:
     EulerRotationItem();
     void serialize(Streamer& s) override;
-    DoubleDescriptors rotationValues() const override { return {m_alpha, m_beta, m_gamma}; };
+    DoubleDescriptors rotationValues() override { return {m_alpha, m_beta, m_gamma}; };
 
     void setAlpha(double v) { m_alpha.set(v); }
     void setBeta(double v) { m_beta.set(v); }
diff --git a/GUI/View/SampleDesigner/LayerEditorUtils.h b/GUI/View/SampleDesigner/LayerEditorUtils.h
index 54462cadcbb..8904fd3461c 100644
--- a/GUI/View/SampleDesigner/LayerEditorUtils.h
+++ b/GUI/View/SampleDesigner/LayerEditorUtils.h
@@ -16,7 +16,6 @@
 #define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYEREDITORUTILS_H
 
 #include "GUI/Model/Descriptor/DoubleProperty.h"
-
 #include "GUI/Model/CatSample/FormFactorItemCatalog.h"
 #include "GUI/Model/CatSample/ItemWithParticlesCatalog.h"
 #include <QColor>
-- 
GitLab


From 921def60cac7867ae22dba4ad8afb7d6c3e2708d Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Wed, 30 Nov 2022 15:08:42 +0100
Subject: [PATCH 05/13] FormFactorItems: return non-const list of descriptors

---
 GUI/Model/Model/ParameterTreeUtils.cpp     |  4 +-
 GUI/Model/Sample/FormFactorItems.h         | 61 ++++++++++------------
 GUI/View/SampleDesigner/LayerEditorUtils.h |  2 +-
 3 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/GUI/Model/Model/ParameterTreeUtils.cpp b/GUI/Model/Model/ParameterTreeUtils.cpp
index 96d528040b1..2a11adfb8ff 100644
--- a/GUI/Model/Model/ParameterTreeUtils.cpp
+++ b/GUI/Model/Model/ParameterTreeUtils.cpp
@@ -256,7 +256,7 @@ ParameterLabelItem* ParameterTreeBuilder::addParticle(ParameterLabelItem* parent
     addRotation(label, p);
 
     if (const auto* particle = dynamic_cast<const ParticleItem*>(p)) {
-        const auto* formFactor = particle->formfactor();
+        auto* formFactor = particle->formfactor();
         auto* ffLabel = addLabel<FormFactorItemCatalog>(label, "Formfactor", formFactor);
         for (const auto& d : formFactor->geometryValues())
             addParameterItem(ffLabel, d);
@@ -273,7 +273,7 @@ ParameterLabelItem* ParameterTreeBuilder::addParticle(ParameterLabelItem* parent
         addParameterItem(label, meso->vectorB());
         addParameterItem(label, meso->vectorC());
 
-        const auto* outerShape = meso->outerShape().currentItem();
+        auto* outerShape = meso->outerShape().currentItem();
         auto* ffLabel = addLabel<FormFactorItemCatalog>(label, "Outer shape", outerShape);
         for (const auto& d : outerShape->geometryValues())
             addParameterItem(ffLabel, d);
diff --git a/GUI/Model/Sample/FormFactorItems.h b/GUI/Model/Sample/FormFactorItems.h
index efec54fd255..5016e76cee5 100644
--- a/GUI/Model/Sample/FormFactorItems.h
+++ b/GUI/Model/Sample/FormFactorItems.h
@@ -38,7 +38,7 @@ public:
 
 public:
     virtual std::unique_ptr<IFormFactor> createFormFactor() const = 0;
-    virtual DoubleDescriptors geometryValues() const = 0;
+    virtual DoubleDescriptors geometryValues() = 0;
     virtual void serialize(Streamer& s) = 0;
 };
 
@@ -52,10 +52,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(alpha, Alpha)
 
-    DoubleDescriptors geometryValues() const override
-    {
-        return {m_length, m_width, m_height, m_alpha};
-    }
+    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height, m_alpha}; }
     void serialize(Streamer& s) override;
 };
 
@@ -68,7 +65,7 @@ public:
     FF_PROPERTY(width, Width)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() const override { return {m_length, m_width, m_height}; }
+    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -81,7 +78,7 @@ public:
     FF_PROPERTY(width, Width)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() const override { return {m_length, m_width, m_height}; }
+    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -94,7 +91,7 @@ public:
     FF_PROPERTY(width, Width)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() const override { return {m_length, m_width, m_height}; }
+    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -107,7 +104,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(alpha, Alpha)
 
-    DoubleDescriptors geometryValues() const override { return {m_radius, m_height, m_alpha}; }
+    DoubleDescriptors geometryValues() override { return {m_radius, m_height, m_alpha}; }
     void serialize(Streamer& s) override;
 };
 
@@ -120,7 +117,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(alpha, Alpha)
 
-    DoubleDescriptors geometryValues() const override { return {m_baseEdge, m_height, m_alpha}; }
+    DoubleDescriptors geometryValues() override { return {m_baseEdge, m_height, m_alpha}; }
     void serialize(Streamer& s) override;
 };
 
@@ -134,7 +131,7 @@ public:
     FF_PROPERTY(heightRatio, HeightRatio)
     FF_PROPERTY(alpha, Alpha)
 
-    DoubleDescriptors geometryValues() const override
+    DoubleDescriptors geometryValues() override
     {
         return {m_length, m_height, m_heightRatio, m_alpha};
     }
@@ -149,7 +146,7 @@ public:
     FF_PROPERTY(radius, Radius)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() const override { return {m_radius, m_height}; }
+    DoubleDescriptors geometryValues() override { return {m_radius, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -162,7 +159,7 @@ public:
     FF_PROPERTY(radiusY, RadiusY)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() const override { return {m_radiusX, m_radiusY, m_height}; }
+    DoubleDescriptors geometryValues() override { return {m_radiusX, m_radiusY, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -173,7 +170,7 @@ public:
 
     FF_PROPERTY(radius, Radius)
 
-    DoubleDescriptors geometryValues() const override { return {m_radius}; }
+    DoubleDescriptors geometryValues() override { return {m_radius}; }
     void serialize(Streamer& s) override;
 };
 
@@ -185,7 +182,7 @@ public:
     FF_PROPERTY(radius, Radius)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() const override { return {m_radius, m_height}; }
+    DoubleDescriptors geometryValues() override { return {m_radius, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -198,7 +195,7 @@ public:
     FF_PROPERTY(radiusY, RadiusY)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() const override { return {m_radiusX, m_radiusY, m_height}; }
+    DoubleDescriptors geometryValues() override { return {m_radiusX, m_radiusY, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -210,7 +207,7 @@ public:
     FF_PROPERTY(baseEdge, BaseEdge)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() const override { return {m_baseEdge, m_height}; }
+    DoubleDescriptors geometryValues() override { return {m_baseEdge, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -222,7 +219,7 @@ public:
     FF_PROPERTY(baseEdge, BaseEdge)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() const override { return {m_baseEdge, m_height}; }
+    DoubleDescriptors geometryValues() override { return {m_baseEdge, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -235,7 +232,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(alpha, Alpha)
 
-    DoubleDescriptors geometryValues() const override { return {m_baseEdge, m_height, m_alpha}; }
+    DoubleDescriptors geometryValues() override { return {m_baseEdge, m_height, m_alpha}; }
     void serialize(Streamer& s) override;
 };
 
@@ -248,7 +245,7 @@ public:
     FF_PROPERTY(width, Width)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() const override { return {m_length, m_width, m_height}; }
+    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -261,7 +258,7 @@ public:
     FF_PROPERTY(width, Width)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() const override { return {m_length, m_width, m_height}; }
+    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -274,7 +271,7 @@ public:
     FF_PROPERTY(width, Width)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() const override { return {m_length, m_width, m_height}; }
+    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -288,7 +285,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(asymmetry, Asymmetry)
 
-    DoubleDescriptors geometryValues() const override
+    DoubleDescriptors geometryValues() override
     {
         return {m_length, m_width, m_height, m_asymmetry};
     }
@@ -305,7 +302,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(asymmetry, Asymmetry)
 
-    DoubleDescriptors geometryValues() const override
+    DoubleDescriptors geometryValues() override
     {
         return {m_length, m_width, m_height, m_asymmetry};
     }
@@ -322,7 +319,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(asymmetry, Asymmetry)
 
-    DoubleDescriptors geometryValues() const override
+    DoubleDescriptors geometryValues() override
     {
         return {m_length, m_width, m_height, m_asymmetry};
     }
@@ -338,7 +335,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(alpha, Alpha)
 
-    DoubleDescriptors geometryValues() const override { return {m_baseEdge, m_height, m_alpha}; }
+    DoubleDescriptors geometryValues() override { return {m_baseEdge, m_height, m_alpha}; }
     void serialize(Streamer& s) override;
 };
 
@@ -350,7 +347,7 @@ public:
     FF_PROPERTY(length, Length)
     FF_PROPERTY(removedLength, RemovedLength)
 
-    DoubleDescriptors geometryValues() const override { return {m_length, m_removedLength}; }
+    DoubleDescriptors geometryValues() override { return {m_length, m_removedLength}; }
     void serialize(Streamer& s) override;
 };
 
@@ -363,7 +360,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(removedTop, RemovedTop)
 
-    DoubleDescriptors geometryValues() const override { return {m_radius, m_height, m_removedTop}; }
+    DoubleDescriptors geometryValues() override { return {m_radius, m_height, m_removedTop}; }
     void serialize(Streamer& s) override;
 };
 
@@ -377,7 +374,7 @@ public:
     FF_PROPERTY(heightFlattening, HeightFlattening)
     FF_PROPERTY(removedTop, RemovedTop)
 
-    DoubleDescriptors geometryValues() const override
+    DoubleDescriptors geometryValues() override
     {
         return {m_radius, m_height, m_heightFlattening, m_removedTop};
     }
@@ -392,7 +389,7 @@ public:
     FF_PROPERTY(length, Length)
     FF_PROPERTY(removedLength, RemovedLength)
 
-    DoubleDescriptors geometryValues() const override { return {m_length, m_removedLength}; }
+    DoubleDescriptors geometryValues() override { return {m_length, m_removedLength}; }
     void serialize(Streamer& s) override;
 };
 
@@ -406,7 +403,7 @@ public:
     FF_PROPERTY(sliceBottom, SliceBottom)
     FF_PROPERTY(sliceTop, SliceTop)
 
-    DoubleDescriptors geometryValues() const override
+    DoubleDescriptors geometryValues() override
     {
         return {m_radius, m_length, m_sliceBottom, m_sliceTop};
     }
@@ -419,7 +416,7 @@ class PlatonicItem : public FormFactorItem {
 public:
     FF_PROPERTY(edge, Edge)
 
-    DoubleDescriptors geometryValues() const override { return {m_edge}; }
+    DoubleDescriptors geometryValues() override { return {m_edge}; }
     void serialize(Streamer& s) override;
 };
 
diff --git a/GUI/View/SampleDesigner/LayerEditorUtils.h b/GUI/View/SampleDesigner/LayerEditorUtils.h
index 8904fd3461c..67b16e8a239 100644
--- a/GUI/View/SampleDesigner/LayerEditorUtils.h
+++ b/GUI/View/SampleDesigner/LayerEditorUtils.h
@@ -15,9 +15,9 @@
 #ifndef BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYEREDITORUTILS_H
 #define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_LAYEREDITORUTILS_H
 
-#include "GUI/Model/Descriptor/DoubleProperty.h"
 #include "GUI/Model/CatSample/FormFactorItemCatalog.h"
 #include "GUI/Model/CatSample/ItemWithParticlesCatalog.h"
+#include "GUI/Model/Descriptor/DoubleProperty.h"
 #include <QColor>
 #include <QList>
 #include <functional>
-- 
GitLab


From dbbd5f25328f99291af831499c0f1c63d23d0ab3 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Wed, 30 Nov 2022 15:32:07 +0100
Subject: [PATCH 06/13] DistributionItems: return non-const list of descriptors

---
 GUI/Model/Descriptor/DistributionItems.cpp | 16 ++++++++--------
 GUI/Model/Descriptor/DistributionItems.h   | 16 ++++++++--------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/GUI/Model/Descriptor/DistributionItems.cpp b/GUI/Model/Descriptor/DistributionItems.cpp
index ef842298c8d..841c20a3109 100644
--- a/GUI/Model/Descriptor/DistributionItems.cpp
+++ b/GUI/Model/Descriptor/DistributionItems.cpp
@@ -128,7 +128,7 @@ void DistributionNoneItem::initDistribution(double value)
     setMean(value);
 }
 
-DoubleDescriptors DistributionNoneItem::distributionValues(bool withMean) const
+DoubleDescriptors DistributionNoneItem::distributionValues(bool withMean)
 {
     return withMean ? DoubleDescriptors{m_mean} : DoubleDescriptors{};
 }
@@ -176,9 +176,9 @@ void DistributionGateItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Maximum, m_maximum);
 }
 
-DoubleDescriptors DistributionGateItem::distributionValues(bool /*withMean*/) const
+DoubleDescriptors DistributionGateItem::distributionValues(bool /*withMean*/)
 {
-    return {minimum(), maximum()};
+    return {m_minimum, m_maximum};
 }
 
 // --------------------------------------------------------------------------------------------- //
@@ -231,7 +231,7 @@ void DistributionLorentzItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::HWHM, m_hwhm);
 }
 
-DoubleDescriptors DistributionLorentzItem::distributionValues(bool withMean) const
+DoubleDescriptors DistributionLorentzItem::distributionValues(bool withMean)
 {
     return withMean ? DoubleDescriptors{m_mean, m_hwhm, m_sigmaFactor}
                     : DoubleDescriptors{m_hwhm, m_sigmaFactor};
@@ -288,7 +288,7 @@ void DistributionGaussianItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::StandardDeviation, m_standardDeviation);
 }
 
-DoubleDescriptors DistributionGaussianItem::distributionValues(bool withMean) const
+DoubleDescriptors DistributionGaussianItem::distributionValues(bool withMean)
 {
     return withMean ? DoubleDescriptors{m_mean, m_standardDeviation, m_sigmaFactor}
                     : DoubleDescriptors{m_standardDeviation, m_sigmaFactor};
@@ -332,7 +332,7 @@ void DistributionLogNormalItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::ScaleParameter, m_scaleParameter);
 }
 
-DoubleDescriptors DistributionLogNormalItem::distributionValues(bool /*withMean*/) const
+DoubleDescriptors DistributionLogNormalItem::distributionValues(bool /*withMean*/)
 {
     return {m_median, m_scaleParameter, m_sigmaFactor};
 }
@@ -386,7 +386,7 @@ void DistributionCosineItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Sigma, m_sigma);
 }
 
-DoubleDescriptors DistributionCosineItem::distributionValues(bool withMean) const
+DoubleDescriptors DistributionCosineItem::distributionValues(bool withMean)
 {
     return withMean ? DoubleDescriptors{m_mean, m_sigma, m_sigmaFactor}
                     : DoubleDescriptors{m_sigma, m_sigmaFactor};
@@ -438,7 +438,7 @@ void DistributionTrapezoidItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::RightWidth, m_rightWidth);
 }
 
-DoubleDescriptors DistributionTrapezoidItem::distributionValues(bool withMean) const
+DoubleDescriptors DistributionTrapezoidItem::distributionValues(bool withMean)
 {
     return withMean ? DoubleDescriptors{m_center, m_leftWidth, m_middleWidth, m_rightWidth}
                     : DoubleDescriptors{m_leftWidth, m_middleWidth, m_rightWidth};
diff --git a/GUI/Model/Descriptor/DistributionItems.h b/GUI/Model/Descriptor/DistributionItems.h
index d9d22b1d35d..b25ee975361 100644
--- a/GUI/Model/Descriptor/DistributionItems.h
+++ b/GUI/Model/Descriptor/DistributionItems.h
@@ -56,7 +56,7 @@ public:
     //! to be set again by the owner of DistributionItem after reading it
     virtual void serialize(Streamer& s);
 
-    virtual DoubleDescriptors distributionValues(bool withMean = true) const = 0;
+    virtual DoubleDescriptors distributionValues(bool withMean = true) = 0;
 
 protected:
     void initSigmaFactor();
@@ -89,7 +89,7 @@ public:
     double deviation(double scale) const override;
     void initDistribution(double value) override;
 
-    DoubleDescriptors distributionValues(bool withMean = true) const override;
+    DoubleDescriptors distributionValues(bool withMean = true) override;
 };
 
 class DistributionGateItem : public DistributionItem {
@@ -106,7 +106,7 @@ public:
     void setRange(double min, double max);
 
     void serialize(Streamer& s) override;
-    DoubleDescriptors distributionValues(bool withMean = true) const override;
+    DoubleDescriptors distributionValues(bool withMean = true) override;
 };
 
 class DistributionLorentzItem : public SymmetricResolutionItem {
@@ -123,7 +123,7 @@ public:
     void initDistribution(double value) override;
 
     void serialize(Streamer& s) override;
-    DoubleDescriptors distributionValues(bool withMean = true) const override;
+    DoubleDescriptors distributionValues(bool withMean = true) override;
 };
 
 class DistributionGaussianItem : public SymmetricResolutionItem {
@@ -140,7 +140,7 @@ public:
     void initDistribution(double value) override;
     void serialize(Streamer& s) override;
 
-    DoubleDescriptors distributionValues(bool withMean = true) const override;
+    DoubleDescriptors distributionValues(bool withMean = true) override;
 };
 
 class DistributionLogNormalItem : public DistributionItem {
@@ -155,7 +155,7 @@ public:
     DOUBLE_PROPERTY(scaleParameter, ScaleParameter);
 
     void serialize(Streamer& s) override;
-    DoubleDescriptors distributionValues(bool withMean = true) const override;
+    DoubleDescriptors distributionValues(bool withMean = true) override;
 };
 
 class DistributionCosineItem : public SymmetricResolutionItem {
@@ -171,7 +171,7 @@ public:
     DOUBLE_PROPERTY(sigma, Sigma);
 
     void serialize(Streamer& s) override;
-    DoubleDescriptors distributionValues(bool withMean = true) const override;
+    DoubleDescriptors distributionValues(bool withMean = true) override;
 };
 
 class DistributionTrapezoidItem : public DistributionItem {
@@ -188,7 +188,7 @@ public:
     DOUBLE_PROPERTY(rightWidth, RightWidth);
 
     void serialize(Streamer& s) override;
-    DoubleDescriptors distributionValues(bool withMean = true) const override;
+    DoubleDescriptors distributionValues(bool withMean = true) override;
 };
 
 #endif // BORNAGAIN_GUI_MODEL_DESCRIPTOR_DISTRIBUTIONITEMS_H
-- 
GitLab


From 7d50af4aa9f4e0c04761c481c6aad8bd91ad801f Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Wed, 30 Nov 2022 15:34:31 +0100
Subject: [PATCH 07/13] Lattice2DItems: return non-const list of descriptors

---
 GUI/Model/Model/ParameterTreeUtils.cpp | 2 +-
 GUI/Model/Sample/Lattice2DItems.h      | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/GUI/Model/Model/ParameterTreeUtils.cpp b/GUI/Model/Model/ParameterTreeUtils.cpp
index 2a11adfb8ff..7ff6700de01 100644
--- a/GUI/Model/Model/ParameterTreeUtils.cpp
+++ b/GUI/Model/Model/ParameterTreeUtils.cpp
@@ -288,7 +288,7 @@ ParameterLabelItem* ParameterTreeBuilder::addParticle(ParameterLabelItem* parent
 void ParameterTreeBuilder::addLattice(ParameterLabelItem* parentLabel,
                                       const Interference2DAbstractLatticeItem* itf)
 {
-    const auto* lattice = itf->latticeType().currentItem();
+    auto* lattice = itf->latticeType().currentItem();
     auto* label = addLabel<Lattice2DItemCatalog>(parentLabel, "Lattice", lattice);
     for (const auto& d : lattice->geometryValues(!itf->xiIntegration()))
         addParameterItem(label, d);
diff --git a/GUI/Model/Sample/Lattice2DItems.h b/GUI/Model/Sample/Lattice2DItems.h
index 3e6d87b97e0..6bbbea11a82 100644
--- a/GUI/Model/Sample/Lattice2DItems.h
+++ b/GUI/Model/Sample/Lattice2DItems.h
@@ -30,7 +30,7 @@ protected:
 public:
     virtual ~Lattice2DItem() = default;
     virtual std::unique_ptr<Lattice2D> createLattice() const = 0;
-    virtual DoubleDescriptors geometryValues(bool withRotationAngle) const = 0;
+    virtual DoubleDescriptors geometryValues(bool withRotationAngle) = 0;
     virtual void serialize(Streamer& s) = 0;
     double unitCellArea() const;
 
@@ -48,7 +48,7 @@ public:
     BasicLattice2DItem();
     std::unique_ptr<Lattice2D> createLattice() const override;
     void serialize(Streamer& s) override;
-    DoubleDescriptors geometryValues(bool withRotationAngle) const override
+    DoubleDescriptors geometryValues(bool withRotationAngle) override
     {
         if (withRotationAngle)
             return {m_length1, m_length2, m_angle, m_latticeRotationAngle};
@@ -77,7 +77,7 @@ public:
     SquareLattice2DItem();
     std::unique_ptr<Lattice2D> createLattice() const override;
     void serialize(Streamer& s) override;
-    DoubleDescriptors geometryValues(bool withRotationAngle) const override
+    DoubleDescriptors geometryValues(bool withRotationAngle) override
     {
         if (withRotationAngle)
             return {m_length, m_latticeRotationAngle};
@@ -98,7 +98,7 @@ public:
     HexagonalLattice2DItem();
     std::unique_ptr<Lattice2D> createLattice() const override;
     void serialize(Streamer& s) override;
-    DoubleDescriptors geometryValues(bool withRotationAngle) const override
+    DoubleDescriptors geometryValues(bool withRotationAngle) override
     {
         if (withRotationAngle)
             return {m_length, m_latticeRotationAngle};
-- 
GitLab


From 5add05ee73f1d6faa5f6afa616a6cadbf2ee3a68 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Wed, 30 Nov 2022 15:41:50 +0100
Subject: [PATCH 08/13] Lattice2DItem: descriptor interface --> property

---
 GUI/Model/Sample/Lattice2DItems.cpp | 25 +++++++------------------
 GUI/Model/Sample/Lattice2DItems.h   |  5 ++---
 2 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/GUI/Model/Sample/Lattice2DItems.cpp b/GUI/Model/Sample/Lattice2DItems.cpp
index 74884987989..fe63800bc60 100644
--- a/GUI/Model/Sample/Lattice2DItems.cpp
+++ b/GUI/Model/Sample/Lattice2DItems.cpp
@@ -42,15 +42,6 @@ double Lattice2DItem::unitCellArea() const
     return createLattice()->unitCellArea();
 }
 
-DoubleDescriptor Lattice2DItem::latticeRotationAngle() const
-{
-    return m_latticeRotationAngle;
-}
-
-void Lattice2DItem::setLatticeRotationAngle(const double angle)
-{
-    m_latticeRotationAngle.set(angle);
-}
 
 // --------------------------------------------------------------------------------------------- //
 
@@ -65,8 +56,9 @@ BasicLattice2DItem::BasicLattice2DItem()
 
 std::unique_ptr<Lattice2D> BasicLattice2DItem::createLattice() const
 {
-    return std::make_unique<BasicLattice2D>(m_length1, m_length2, Units::deg2rad(m_angle),
-                                            Units::deg2rad(latticeRotationAngle()));
+    return std::make_unique<BasicLattice2D>(m_length1.get(), m_length2.get(),
+                                            Units::deg2rad(m_angle.get()),
+                                            Units::deg2rad(m_latticeRotationAngle.get()));
 }
 
 void BasicLattice2DItem::serialize(Streamer& s)
@@ -118,7 +110,8 @@ SquareLattice2DItem::SquareLattice2DItem()
 
 std::unique_ptr<Lattice2D> SquareLattice2DItem::createLattice() const
 {
-    return std::make_unique<SquareLattice2D>(m_length, Units::deg2rad(latticeRotationAngle()));
+    return std::make_unique<SquareLattice2D>(m_length,
+                                             Units::deg2rad(m_latticeRotationAngle.get()));
 }
 
 void SquareLattice2DItem::serialize(Streamer& s)
@@ -128,11 +121,6 @@ void SquareLattice2DItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Length, m_length);
 }
 
-DoubleDescriptor SquareLattice2DItem::latticeLength() const
-{
-    return m_length;
-}
-
 void SquareLattice2DItem::setLatticeLength(const double length)
 {
     m_length.set(length);
@@ -148,7 +136,8 @@ HexagonalLattice2DItem::HexagonalLattice2DItem()
 
 std::unique_ptr<Lattice2D> HexagonalLattice2DItem::createLattice() const
 {
-    return std::make_unique<HexagonalLattice2D>(m_length, Units::deg2rad(latticeRotationAngle()));
+    return std::make_unique<HexagonalLattice2D>(m_length.get(),
+                                                Units::deg2rad(m_latticeRotationAngle.get()));
 }
 
 void HexagonalLattice2DItem::serialize(Streamer& s)
diff --git a/GUI/Model/Sample/Lattice2DItems.h b/GUI/Model/Sample/Lattice2DItems.h
index 6bbbea11a82..2c38615b512 100644
--- a/GUI/Model/Sample/Lattice2DItems.h
+++ b/GUI/Model/Sample/Lattice2DItems.h
@@ -34,8 +34,8 @@ public:
     virtual void serialize(Streamer& s) = 0;
     double unitCellArea() const;
 
-    DoubleDescriptor latticeRotationAngle() const;
-    void setLatticeRotationAngle(double angle);
+    DoubleProperty& latticeRotationAngle() { return m_latticeRotationAngle; }
+    void setLatticeRotationAngle(double v) { m_latticeRotationAngle.set(v); }
 
 protected:
     DoubleProperty m_latticeRotationAngle;
@@ -84,7 +84,6 @@ public:
         return {m_length};
     }
 
-    DoubleDescriptor latticeLength() const;
     void setLatticeLength(double length);
 
 private:
-- 
GitLab


From 3b3232d938d15eabc848a06a6fec8fcc713d6976 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Wed, 30 Nov 2022 15:46:57 +0100
Subject: [PATCH 09/13] Lattice2DItem: rm unneeded interfaces

---
 GUI/Model/Sample/Lattice2DItems.cpp | 46 -----------------------------
 GUI/Model/Sample/Lattice2DItems.h   | 16 ++++------
 2 files changed, 5 insertions(+), 57 deletions(-)

diff --git a/GUI/Model/Sample/Lattice2DItems.cpp b/GUI/Model/Sample/Lattice2DItems.cpp
index fe63800bc60..96152bdd755 100644
--- a/GUI/Model/Sample/Lattice2DItems.cpp
+++ b/GUI/Model/Sample/Lattice2DItems.cpp
@@ -42,7 +42,6 @@ double Lattice2DItem::unitCellArea() const
     return createLattice()->unitCellArea();
 }
 
-
 // --------------------------------------------------------------------------------------------- //
 
 BasicLattice2DItem::BasicLattice2DItem()
@@ -70,36 +69,6 @@ void BasicLattice2DItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Angle, m_angle);
 }
 
-DoubleDescriptor BasicLattice2DItem::latticeLength1() const
-{
-    return m_length1;
-}
-
-void BasicLattice2DItem::setLatticeLength1(const double length1)
-{
-    m_length1.set(length1);
-}
-
-DoubleDescriptor BasicLattice2DItem::latticeLength2() const
-{
-    return m_length2;
-}
-
-void BasicLattice2DItem::setLatticeLength2(const double length2)
-{
-    m_length2.set(length2);
-}
-
-DoubleDescriptor BasicLattice2DItem::latticeAngle() const
-{
-    return m_angle;
-}
-
-void BasicLattice2DItem::setLatticeAngle(const double angle)
-{
-    m_angle.set(angle);
-}
-
 // --------------------------------------------------------------------------------------------- //
 
 SquareLattice2DItem::SquareLattice2DItem()
@@ -121,11 +90,6 @@ void SquareLattice2DItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Length, m_length);
 }
 
-void SquareLattice2DItem::setLatticeLength(const double length)
-{
-    m_length.set(length);
-}
-
 // --------------------------------------------------------------------------------------------- //
 
 HexagonalLattice2DItem::HexagonalLattice2DItem()
@@ -146,13 +110,3 @@ void HexagonalLattice2DItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::LatticeRotationAngle, m_latticeRotationAngle);
     Serialize::rwProperty(s, Tag::Length, m_length);
 }
-
-DoubleDescriptor HexagonalLattice2DItem::latticeLength() const
-{
-    return m_length;
-}
-
-void HexagonalLattice2DItem::setLatticeLength(const double length)
-{
-    m_length.set(length);
-}
diff --git a/GUI/Model/Sample/Lattice2DItems.h b/GUI/Model/Sample/Lattice2DItems.h
index 2c38615b512..8254bfc2d2a 100644
--- a/GUI/Model/Sample/Lattice2DItems.h
+++ b/GUI/Model/Sample/Lattice2DItems.h
@@ -55,14 +55,9 @@ public:
         return {m_length1, m_length2, m_angle};
     }
 
-    DoubleDescriptor latticeLength1() const;
-    void setLatticeLength1(double length1);
-
-    DoubleDescriptor latticeLength2() const;
-    void setLatticeLength2(double length2);
-
-    DoubleDescriptor latticeAngle() const;
-    void setLatticeAngle(double angle);
+    void setLatticeLength1(double v) { m_length1.set(v); }
+    void setLatticeLength2(double v) { m_length2.set(v); }
+    void setLatticeAngle(double v) { m_angle.set(v); }
 
 private:
     DoubleProperty m_length1;
@@ -84,7 +79,7 @@ public:
         return {m_length};
     }
 
-    void setLatticeLength(double length);
+    void setLatticeLength(double v) { m_length.set(v); }
 
 private:
     DoubleProperty m_length;
@@ -104,8 +99,7 @@ public:
         return {m_length};
     }
 
-    DoubleDescriptor latticeLength() const;
-    void setLatticeLength(double length);
+    void setLatticeLength(double v) { m_length.set(v); }
 
 private:
     DoubleProperty m_length;
-- 
GitLab


From f7ab76a09f8c1932b9fd6926f92df177c7c34ee4 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Wed, 30 Nov 2022 15:51:55 +0100
Subject: [PATCH 10/13] DoubleProperty: make limits() & decimals() const

---
 GUI/Model/Descriptor/DoubleProperty.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/GUI/Model/Descriptor/DoubleProperty.h b/GUI/Model/Descriptor/DoubleProperty.h
index c44ee6998bd..07d152e272b 100644
--- a/GUI/Model/Descriptor/DoubleProperty.h
+++ b/GUI/Model/Descriptor/DoubleProperty.h
@@ -71,7 +71,7 @@ public:
 
     QString label() const { return m_label; }
 
-    uint decimals() { return m_decimals; }
+    uint decimals() const { return m_decimals; }
     void setDecimals(uint decimals) { m_decimals = decimals; }
 
     QString tooltip() const { return m_tooltip; }
@@ -80,7 +80,7 @@ public:
     std::variant<QString, Unit> unit() const { return m_unit; }
     void setUnit(const std::variant<QString, Unit>& unit);
 
-    RealLimits limits() { return m_limits; }
+    RealLimits limits() const { return m_limits; }
     void setLimits(const RealLimits& limits);
 
     //! True if one of the init methods has been called (checks for a valid uid).
@@ -120,6 +120,7 @@ public:                                                                 \
 
 // clang-format on
 
+//using DoubleDescriptors = QList<DoubleDescriptor>;
 using DoubleDescriptors = QList<DoubleDescriptor>;
 
 #endif // BORNAGAIN_GUI_MODEL_DESCRIPTOR_DOUBLEPROPERTY_H
-- 
GitLab


From 9980e141f7168c5e777cd6672ba26836e106f887 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Wed, 30 Nov 2022 16:16:19 +0100
Subject: [PATCH 11/13] Main transition from DoubleDescriptor to
 DoubleProperty&

---
 GUI/Model/Descriptor/DoubleProperty.h         |  2 +-
 GUI/Model/Model/ParameterTreeUtils.cpp        | 28 +++++++++---------
 GUI/Model/Model/ParameterTreeUtils.h          | 26 ++++++++---------
 GUI/View/SampleDesigner/FormLayouter.cpp      | 12 ++++----
 GUI/View/SampleDesigner/FormLayouter.h        | 29 +++++++++----------
 GUI/View/SampleDesigner/InterferenceForm.cpp  |  2 +-
 GUI/View/SampleDesigner/LayerEditorUtils.cpp  | 10 +++----
 GUI/View/SampleDesigner/LayerEditorUtils.h    |  4 +--
 .../SampleDesigner/MaterialInplaceForm.cpp    |  4 +--
 9 files changed, 58 insertions(+), 59 deletions(-)

diff --git a/GUI/Model/Descriptor/DoubleProperty.h b/GUI/Model/Descriptor/DoubleProperty.h
index 07d152e272b..75afbbe419f 100644
--- a/GUI/Model/Descriptor/DoubleProperty.h
+++ b/GUI/Model/Descriptor/DoubleProperty.h
@@ -121,6 +121,6 @@ public:                                                                 \
 // clang-format on
 
 //using DoubleDescriptors = QList<DoubleDescriptor>;
-using DoubleDescriptors = QList<DoubleDescriptor>;
+using DoubleDescriptors = QList<std::reference_wrapper<DoubleProperty>>;
 
 #endif // BORNAGAIN_GUI_MODEL_DESCRIPTOR_DOUBLEPROPERTY_H
diff --git a/GUI/Model/Model/ParameterTreeUtils.cpp b/GUI/Model/Model/ParameterTreeUtils.cpp
index 7ff6700de01..bb3913bb7ea 100644
--- a/GUI/Model/Model/ParameterTreeUtils.cpp
+++ b/GUI/Model/Model/ParameterTreeUtils.cpp
@@ -140,17 +140,17 @@ void ParameterTreeBuilder::addSample()
     }
 }
 
-void ParameterTreeBuilder::addParameterItem(ParameterLabelItem* parent, const DoubleDescriptor& d,
+void ParameterTreeBuilder::addParameterItem(ParameterLabelItem* parent, DoubleProperty& d,
                                             const QString& label)
 {
     auto* parameterItem = new ParameterItem(parent);
-    parameterItem->setTitle(labelWithUnit(label.isEmpty() ? d.label : label, d.unit));
+    parameterItem->setTitle(labelWithUnit(label.isEmpty() ? d.label() : label, d.unit()));
     parameterItem->linkToDescriptor(d);
     if (m_recreateBackupValues)
         m_jobItem->parameterContainerItem()->setBackupValue(parameterItem->link(), d.get());
 }
 
-void ParameterTreeBuilder::addParameterItem(ParameterLabelItem* parent, const VectorProperty& d)
+void ParameterTreeBuilder::addParameterItem(ParameterLabelItem* parent, VectorProperty& d)
 {
     auto* label = new ParameterLabelItem(d.label(), parent);
     addParameterItem(label, d.x());
@@ -172,7 +172,7 @@ bool ParameterTreeBuilder::allowMagneticFields() const
 void ParameterTreeBuilder::addInterference(ParameterLabelItem* layoutLabel,
                                            const ParticleLayoutItem* layout)
 {
-    const auto* interference = layout->interference().currentItem();
+    auto* interference = layout->interference().currentItem();
     if (!interference)
         return;
 
@@ -181,7 +181,7 @@ void ParameterTreeBuilder::addInterference(ParameterLabelItem* layoutLabel,
 
     auto* label = new ParameterLabelItem("Interference (" + title + ")", layoutLabel);
 
-    if (const auto* itf = dynamic_cast<const InterferenceRadialParacrystalItem*>(interference)) {
+    if (auto* itf = dynamic_cast<InterferenceRadialParacrystalItem*>(interference)) {
         addParameterItem(label, itf->positionVariance());
         addParameterItem(label, itf->peakDistance());
         addParameterItem(label, itf->dampingLength());
@@ -192,7 +192,7 @@ void ParameterTreeBuilder::addInterference(ParameterLabelItem* layoutLabel,
         auto* pdfLabel = addLabel<Profile1DItemCatalog>(label, "PDF", pdf);
         for (auto& d : pdf->valueDescriptors())
             addParameterItem(pdfLabel, d);
-    } else if (const auto* itf = dynamic_cast<const Interference2DParacrystalItem*>(interference)) {
+    } else if (auto* itf = dynamic_cast<Interference2DParacrystalItem*>(interference)) {
         addParameterItem(label, itf->positionVariance());
         addParameterItem(label, itf->dampingLength());
         addParameterItem(label, itf->domainSize1());
@@ -211,7 +211,7 @@ void ParameterTreeBuilder::addInterference(ParameterLabelItem* layoutLabel,
             addLabel<Profile2DItemCatalog>(label, samePdfTypes ? "PDF2" : "PDF", pdf2);
         for (const auto& d : pdf2->valueDescriptors())
             addParameterItem(pdf2Label, d);
-    } else if (const auto* itf = dynamic_cast<const Interference1DLatticeItem*>(interference)) {
+    } else if (auto* itf = dynamic_cast<Interference1DLatticeItem*>(interference)) {
         addParameterItem(label, itf->positionVariance());
         addParameterItem(label, itf->length());
         addParameterItem(label, itf->rotationAngle());
@@ -220,7 +220,7 @@ void ParameterTreeBuilder::addInterference(ParameterLabelItem* layoutLabel,
         auto* dfLabel = addLabel<Profile1DItemCatalog>(label, "Decay function", df);
         for (const auto& d : df->valueDescriptors())
             addParameterItem(dfLabel, d);
-    } else if (const auto* itf = dynamic_cast<const Interference2DLatticeItem*>(interference)) {
+    } else if (auto* itf = dynamic_cast<Interference2DLatticeItem*>(interference)) {
         addParameterItem(label, itf->positionVariance());
         addLattice(label, itf);
 
@@ -228,15 +228,15 @@ void ParameterTreeBuilder::addInterference(ParameterLabelItem* layoutLabel,
         auto* dfLabel = addLabel<Profile2DItemCatalog>(label, "Decay function", df);
         for (const auto& d : df->valueDescriptors())
             addParameterItem(dfLabel, d);
-    } else if (const auto* itf =
-                   dynamic_cast<const InterferenceFinite2DLatticeItem*>(interference)) {
+    } else if (auto* itf =
+                   dynamic_cast<InterferenceFinite2DLatticeItem*>(interference)) {
         // domainSize1 and domainSize2 are of type UInt (not matching the double approach for tuning
         // and fitting). In BornAgain 1.18 these values have not been added to the tuning tree, and
         // also not to the fitting parameters. Maybe this should be necessary, but for now this
         // stays the same and the two sizes are not added
         addParameterItem(label, itf->positionVariance());
         addLattice(label, itf);
-    } else if (const auto* itf = dynamic_cast<const InterferenceHardDiskItem*>(interference)) {
+    } else if (auto* itf = dynamic_cast<InterferenceHardDiskItem*>(interference)) {
         addParameterItem(label, itf->positionVariance());
         addParameterItem(label, itf->radius());
         addParameterItem(label, itf->density());
@@ -268,7 +268,7 @@ ParameterLabelItem* ParameterTreeBuilder::addParticle(ParameterLabelItem* parent
         l->setTitle(l->title() + " (Core)");
         l = addParticle(label, coreShell->shell(), false, false);
         l->setTitle(l->title() + " (Shell)");
-    } else if (const auto* meso = dynamic_cast<const MesocrystalItem*>(p)) {
+    } else if (auto* meso = dynamic_cast<MesocrystalItem*>(p)) {
         addParameterItem(label, meso->vectorA());
         addParameterItem(label, meso->vectorB());
         addParameterItem(label, meso->vectorC());
@@ -307,7 +307,7 @@ void ParameterTreeBuilder::addRotation(ParameterLabelItem* parentLabel, ItemWith
 
 void ParameterTreeBuilder::addInstrument()
 {
-    const auto* instrument = m_jobItem->instrumentItem();
+    auto* instrument = m_jobItem->instrumentItem();
     auto* label = new ParameterLabelItem(instrument->instrumentType() + " instrument",
                                          parameterContainer()->parameterTreeRoot());
 
@@ -415,7 +415,7 @@ void ParameterTreeBuilder::addBackground(ParameterLabelItem* instrumentLabel,
 }
 
 void ParameterTreeBuilder::addPolarization(ParameterLabelItem* instrumentLabel,
-                                           const InstrumentItem* instrument)
+                                           InstrumentItem* instrument)
 {
     if (!instrument->withPolarizerAnalyzer())
         return;
diff --git a/GUI/Model/Model/ParameterTreeUtils.h b/GUI/Model/Model/ParameterTreeUtils.h
index 114decb0b03..1cb2db931d6 100644
--- a/GUI/Model/Model/ParameterTreeUtils.h
+++ b/GUI/Model/Model/ParameterTreeUtils.h
@@ -20,20 +20,20 @@
 #include <functional>
 #include <variant>
 
+class BackgroundItem;
+class BeamDistributionItem;
+class BeamItem;
+class DetectorItem;
+class DoubleProperty;
+class InstrumentItem;
+class Interference2DAbstractLatticeItem;
+class ItemWithParticles;
 class JobItem;
+class ParameterContainerItem;
 class ParameterItem;
 class ParameterLabelItem;
-class ParameterContainerItem;
-class DoubleDescriptor;
-class VectorProperty;
 class ParticleLayoutItem;
-class ItemWithParticles;
-class Interference2DAbstractLatticeItem;
-class BeamItem;
-class BeamDistributionItem;
-class DetectorItem;
-class BackgroundItem;
-class InstrumentItem;
+class VectorProperty;
 
 //! The ParameterTreeBuilder contains helper functions to create container
 //! with ParameterItems. The ParameterItem appears in RealTimeView and provides real
@@ -52,9 +52,9 @@ private:
     //! add the job's sample
     void addSample();
     void addInstrument();
-    void addParameterItem(ParameterLabelItem* parent, const DoubleDescriptor& d,
+    void addParameterItem(ParameterLabelItem* parent, DoubleProperty& d,
                           const QString& label = QString());
-    void addParameterItem(ParameterLabelItem* parent, const VectorProperty& d);
+    void addParameterItem(ParameterLabelItem* parent, VectorProperty &d);
     ParameterContainerItem* parameterContainer();
     bool allowMagneticFields() const;
 
@@ -72,7 +72,7 @@ private:
 
     void addDetector(ParameterLabelItem* parentLabel, DetectorItem* detector);
     void addBackground(ParameterLabelItem* instrumentLabel, BackgroundItem* backgroundItem);
-    void addPolarization(ParameterLabelItem* instrumentLabel, const InstrumentItem* instrument);
+    void addPolarization(ParameterLabelItem* instrumentLabel, InstrumentItem *instrument);
 
 private:
     JobItem* m_jobItem;
diff --git a/GUI/View/SampleDesigner/FormLayouter.cpp b/GUI/View/SampleDesigner/FormLayouter.cpp
index 5b1c5e34d02..4c603a11c52 100644
--- a/GUI/View/SampleDesigner/FormLayouter.cpp
+++ b/GUI/View/SampleDesigner/FormLayouter.cpp
@@ -89,7 +89,7 @@ int FormLayouter::addGroupOfValues(const QString& labelText, const DoubleDescrip
     return addRow(labelText, w);
 }
 
-int FormLayouter::addVector(const VectorProperty& d, bool vertically /*= true*/)
+int FormLayouter::addVector(VectorProperty& d, bool vertically /*= true*/)
 {
     auto* w = new QWidget(m_formLayout->parentWidget());
     w->setObjectName("PropertyBaseWidget");
@@ -129,28 +129,28 @@ void FormLayouter::addStructureEditingRow(QPushButton* button)
     addRow(w);
 }
 
-int FormLayouter::addValue(const DoubleDescriptor& d)
+int FormLayouter::addValue(DoubleProperty &d)
 {
     insertValue(m_formLayout->rowCount(), d);
     return m_formLayout->rowCount() - 1;
 }
 
-int FormLayouter::addValue(const DoubleDescriptor& d, function<void(double)> onValueChange)
+int FormLayouter::addValue(DoubleProperty &d, function<void(double)> onValueChange)
 {
     insertValue(m_formLayout->rowCount(), d, onValueChange);
     return m_formLayout->rowCount() - 1;
 }
 
-void FormLayouter::insertValue(int row, const DoubleDescriptor& d)
+void FormLayouter::insertValue(int row, DoubleProperty& d)
 {
     auto* ec = m_ec; // to allow copy-capture in the following lambda
     insertValue(row, d, [ec, d](double newValue) { ec->setDouble(newValue, d); });
 }
 
-void FormLayouter::insertValue(int row, const DoubleDescriptor& d,
+void FormLayouter::insertValue(int row, DoubleProperty &d,
                                function<void(double)> onValueChange)
 {
-    auto labelText = d.label;
+    auto labelText = d.label();
     if (!labelText.endsWith(":"))
         labelText += ":";
 
diff --git a/GUI/View/SampleDesigner/FormLayouter.h b/GUI/View/SampleDesigner/FormLayouter.h
index 0ea7d56d75b..f6d6606fd3f 100644
--- a/GUI/View/SampleDesigner/FormLayouter.h
+++ b/GUI/View/SampleDesigner/FormLayouter.h
@@ -19,7 +19,6 @@
 #include "GUI/View/SampleDesigner/SelectionContainerForm.h"
 #include <QFormLayout>
 
-class DoubleDescriptor;
 class QPushButton;
 class QString;
 class QWidget;
@@ -29,8 +28,8 @@ class VectorProperty;
 
 //! Utility class to populate a QFormLayout.
 //!
-//! Helps to add edit controls which operate on descriptors (DoubleDescriptor, UIntDescriptor and so
-//! on). Also takes care of bold printed labels, the connection of labels and edit controls
+//! Helps to add edit controls which operate on Properties (DoubleProperty, VectorProperty, SelectionProperty).
+//! Also takes care of bold printed labels, the connection of labels and edit controls
 //! (buddies), which is necessary to realize the "label shows unit of value" feature.
 //! Connections to a given SampleEditorController are established as well.
 class FormLayouter {
@@ -79,7 +78,7 @@ public:
     //!
     //! The whole selection is realized by adding a SelectionContainerForm. This
     //! SelectionContainerForm is limited to contain the selection combo box and a list of double
-    //! values represented by DoubleDescriptors. To add more complex selections (e.g. with
+    //! values represented by DoubleProperties. To add more complex selections (e.g. with
     //! sub-selections or different value types), this method and the SelectionContainerForm is not
     //! sufficient. It has to be done "manually".
     //! For more details, see SelectionContainerForm.
@@ -89,7 +88,7 @@ public:
 
     //! Adds a row with a bold printed label and a DoubleSpinBox.
     //!
-    //! The DoubleSpinBox is initialized with the contents found in the descriptor (e.g. limits,
+    //! The DoubleSpinBox is initialized with the contents found in the DoubleProperty (e.g. limits,
     //! decimals, unit). The DoubleSpinBox is set as the "buddy" of the label. This is necessary to
     //! realize the "label shows unit of value" feature. Changes of the DoubleSpinBox are signaled
     //! to the SampleEditorController which has been overhanded in the constructor of this
@@ -97,43 +96,43 @@ public:
     //! should be called (e.g. for a special undo functionality), this method is not sufficient. It
     //! would have to be done "manually" or with the overload which takes a slot (see below).
     //! Returns the newly added row.
-    int addValue(const DoubleDescriptor& d);
+    int addValue(DoubleProperty& d);
 
     //! Adds a row with a bold printed label and a DoubleSpinBox.
     //!
     //! Same as above, but the called slot in case of a value change has to be overhanded.
     //! Use this only if the standard (calling SampleEditorController::setDouble()) is not
     //! sufficient.
-    int addValue(const DoubleDescriptor& d, std::function<void(double)> onValueChange);
+    int addValue(DoubleProperty& d, std::function<void(double)> onValueChange);
 
     //! Inserts a row with a bold printed label and a DoubleSpinBox.
     //!
     //! Same functionality as addValue(), please read there.
-    void insertValue(int row, const DoubleDescriptor& d);
+    void insertValue(int row, DoubleProperty &d);
 
     //! Inserts a row with a bold printed label and a DoubleSpinBox.
     //!
     //! Same functionality as addValue(), please read there.
-    void insertValue(int row, const DoubleDescriptor& d, std::function<void(double)> onValueChange);
+    void insertValue(int row, DoubleProperty& d, std::function<void(double)> onValueChange);
 
     //! Adds a row with a bold printed label and a set of DoubleDescriptors.
     //!
-    //! The label describes the set of the Descriptors and is located in the first column of the
-    //! layout. The DoubleSpinBoxes for each DoubleDescriptor are created as children of a newly
+    //! The label describes the set of the DoubleProperties and is located in the first column of the
+    //! layout. The DoubleSpinBoxes for each DoubleProperty are created as children of a newly
     //! created widget, which is positioned in the second column of the layout. If the number of
     //! values is greater than 1, the related labels are shown above them, to limit the necessary
-    //! space to the right. For the creation, signaling, unit handling etc. of one DoubleDescriptor
-    //! the same applies as when adding a single DoubleDesciptor with the method addValue(),
+    //! space to the right. For the creation, signaling, unit handling etc. of one DoubleProperty
+    //! the same applies as when adding a single DoubleProperty with the method addValue(),
     //! therefore please read there for more details. Returns the newly added row.
     int addGroupOfValues(const QString& labelText, const DoubleDescriptors& values);
 
     //! Adds a row with a bold printed label and the 3 values of a 3D vector.
     //!
-    //! Works the same as addGroupOfValues. The label is taken from the VectorDescriptor.
+    //! Works the same as addGroupOfValues. The label is taken from the VectorProperty.
     //! In addition, the caller can define whether the labels are above the values
     //! (vertically=true), or whether labels and values are all placed in one row
     //! (vertically=false).
-    int addVector(const VectorProperty& d, bool vertically = true);
+    int addVector(VectorProperty &d, bool vertically = true);
 
     //! Shows or hides the widgets in a row.
     void setRowVisible(int row, bool visible);
diff --git a/GUI/View/SampleDesigner/InterferenceForm.cpp b/GUI/View/SampleDesigner/InterferenceForm.cpp
index c1457759dd5..94e1890ae06 100644
--- a/GUI/View/SampleDesigner/InterferenceForm.cpp
+++ b/GUI/View/SampleDesigner/InterferenceForm.cpp
@@ -76,7 +76,7 @@ void InterferenceForm::createInterferenceWidgets()
     // provide all the updating (data & UI), the method
     // SampleEditorController::setDensityRelatedValueValue has to be called (instead of
     // SampleEditorController::setDouble). For this we have the following lambda to add a value:
-    const auto addDensityRelatedValue = [&](DoubleDescriptor d) {
+    const auto addDensityRelatedValue = [this, &layouter, interference](DoubleProperty& d) {
         layouter.addValue(
             d, [=](double newValue) { m_ec->setDensityRelatedValue(interference, newValue, d); });
     };
diff --git a/GUI/View/SampleDesigner/LayerEditorUtils.cpp b/GUI/View/SampleDesigner/LayerEditorUtils.cpp
index 14cc40f90ab..4a62eeee2a7 100644
--- a/GUI/View/SampleDesigner/LayerEditorUtils.cpp
+++ b/GUI/View/SampleDesigner/LayerEditorUtils.cpp
@@ -83,9 +83,9 @@ void LayerEditorUtils::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int fir
                                               bool vertically, bool addSpacer)
 {
     int col = firstCol;
-    for (const auto& valueDescriptor : valueDescriptors) {
+    for (const DoubleProperty& valueDescriptor : valueDescriptors) {
         DoubleSpinBox* editor;
-        if (valueDescriptor.label == "Angle")
+        if (valueDescriptor.label() == "Angle")
             editor = new DoubleSpinBox(valueDescriptor, false, 1, 1.0);
         else
             editor = new DoubleSpinBox(valueDescriptor);
@@ -93,7 +93,7 @@ void LayerEditorUtils::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int fir
         QObject::connect(editor, &DoubleSpinBox::baseValueChanged,
                          [=](double newValue) { setNewValue(newValue, valueDescriptor); });
 
-        QString labeltext = valueDescriptor.label;
+        QString labeltext = valueDescriptor.label();
         if (!vertically && !labeltext.endsWith(":"))
             labeltext += ":";
         auto* label = new QLabel(labeltext, m_gridLayout->parentWidget());
@@ -122,7 +122,7 @@ void LayerEditorUtils::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int fir
 }
 
 void LayerEditorUtils::addVectorToGrid(QGridLayout* m_gridLayout, int firstCol,
-                                       const VectorProperty& v, SampleEditorController* ec,
+                                       VectorProperty &v, SampleEditorController* ec,
                                        bool vertically, bool addSpacer)
 {
     addMultiPropertyToGrid(m_gridLayout, firstCol, {v.x(), v.y(), v.z()}, ec, vertically,
@@ -131,7 +131,7 @@ void LayerEditorUtils::addVectorToGrid(QGridLayout* m_gridLayout, int firstCol,
 
 
 void LayerEditorUtils::addVectorToGrid(QGridLayout* m_gridLayout, int firstCol,
-                                       const VectorProperty& v,
+                                       VectorProperty& v,
                                        function<void(double, DoubleDescriptor)> setNewValue,
                                        bool vertically, bool addSpacer)
 {
diff --git a/GUI/View/SampleDesigner/LayerEditorUtils.h b/GUI/View/SampleDesigner/LayerEditorUtils.h
index 67b16e8a239..aab6925c39d 100644
--- a/GUI/View/SampleDesigner/LayerEditorUtils.h
+++ b/GUI/View/SampleDesigner/LayerEditorUtils.h
@@ -61,11 +61,11 @@ void addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol,
 
 //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to
 //! SampleEditorController::setDouble()
-void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, const VectorProperty& v,
+void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v,
                      SampleEditorController* ec, bool vertically, bool addSpacer);
 
 //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to the given setNewValue()
-void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, const VectorProperty& v,
+void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty &v,
                      std::function<void(double, DoubleDescriptor)> setNewValue, bool vertically,
                      bool addSpacer);
 
diff --git a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp
index 17dd9b0361b..75c0ed5fec8 100644
--- a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp
+++ b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp
@@ -99,9 +99,9 @@ void MaterialInplaceForm::createWidgets()
         values << material->sldRe() << material->sldIm();
 
     int col = 0;
-    for (const auto& d : values) {
+    for (const DoubleProperty& d : values) {
         auto* editor = new DoubleLineEdit(this, d);
-        auto* label = new QLabel(d.label, this);
+        auto* label = new QLabel(d.label(), this);
         label->setBuddy(editor);
 
         QObject::connect(editor, &DoubleLineEdit::baseValueChanged,
-- 
GitLab


From 0eec08b36d8924da698ccae1bcef8fd21c9c34c7 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Wed, 30 Nov 2022 16:21:31 +0100
Subject: [PATCH 12/13] DoubleProperty: rnm DoubleDescriptors -->
 DoublePropertyRefs

---
 GUI/Model/Descriptor/DistributionItems.cpp    | 32 +++++-----
 GUI/Model/Descriptor/DistributionItems.h      | 16 ++---
 GUI/Model/Descriptor/DoubleProperty.h         | 15 +----
 GUI/Model/Sample/FormFactorItems.h            | 58 +++++++++----------
 GUI/Model/Sample/Lattice2DItems.h             |  8 +--
 GUI/Model/Sample/ProfileItems.cpp             | 10 ++--
 GUI/Model/Sample/ProfileItems.h               |  8 +--
 GUI/Model/Sample/RotationItems.h              |  6 +-
 GUI/View/SampleDesigner/FormLayouter.cpp      |  2 +-
 GUI/View/SampleDesigner/FormLayouter.h        |  2 +-
 GUI/View/SampleDesigner/LayerEditorUtils.cpp  | 16 ++---
 GUI/View/SampleDesigner/LayerEditorUtils.h    | 16 ++---
 .../SampleDesigner/MaterialInplaceForm.cpp    |  2 +-
 .../SampleDesigner/SelectionContainerForm.h   |  4 +-
 14 files changed, 93 insertions(+), 102 deletions(-)

diff --git a/GUI/Model/Descriptor/DistributionItems.cpp b/GUI/Model/Descriptor/DistributionItems.cpp
index 841c20a3109..b300c361f35 100644
--- a/GUI/Model/Descriptor/DistributionItems.cpp
+++ b/GUI/Model/Descriptor/DistributionItems.cpp
@@ -128,9 +128,9 @@ void DistributionNoneItem::initDistribution(double value)
     setMean(value);
 }
 
-DoubleDescriptors DistributionNoneItem::distributionValues(bool withMean)
+DoublePropertyRefs DistributionNoneItem::distributionValues(bool withMean)
 {
-    return withMean ? DoubleDescriptors{m_mean} : DoubleDescriptors{};
+    return withMean ? DoublePropertyRefs{m_mean} : DoublePropertyRefs{};
 }
 
 // --------------------------------------------------------------------------------------------- //
@@ -176,7 +176,7 @@ void DistributionGateItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Maximum, m_maximum);
 }
 
-DoubleDescriptors DistributionGateItem::distributionValues(bool /*withMean*/)
+DoublePropertyRefs DistributionGateItem::distributionValues(bool /*withMean*/)
 {
     return {m_minimum, m_maximum};
 }
@@ -231,10 +231,10 @@ void DistributionLorentzItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::HWHM, m_hwhm);
 }
 
-DoubleDescriptors DistributionLorentzItem::distributionValues(bool withMean)
+DoublePropertyRefs DistributionLorentzItem::distributionValues(bool withMean)
 {
-    return withMean ? DoubleDescriptors{m_mean, m_hwhm, m_sigmaFactor}
-                    : DoubleDescriptors{m_hwhm, m_sigmaFactor};
+    return withMean ? DoublePropertyRefs{m_mean, m_hwhm, m_sigmaFactor}
+                    : DoublePropertyRefs{m_hwhm, m_sigmaFactor};
 }
 
 // --------------------------------------------------------------------------------------------- //
@@ -288,10 +288,10 @@ void DistributionGaussianItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::StandardDeviation, m_standardDeviation);
 }
 
-DoubleDescriptors DistributionGaussianItem::distributionValues(bool withMean)
+DoublePropertyRefs DistributionGaussianItem::distributionValues(bool withMean)
 {
-    return withMean ? DoubleDescriptors{m_mean, m_standardDeviation, m_sigmaFactor}
-                    : DoubleDescriptors{m_standardDeviation, m_sigmaFactor};
+    return withMean ? DoublePropertyRefs{m_mean, m_standardDeviation, m_sigmaFactor}
+                    : DoublePropertyRefs{m_standardDeviation, m_sigmaFactor};
 }
 
 // --------------------------------------------------------------------------------------------- //
@@ -332,7 +332,7 @@ void DistributionLogNormalItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::ScaleParameter, m_scaleParameter);
 }
 
-DoubleDescriptors DistributionLogNormalItem::distributionValues(bool /*withMean*/)
+DoublePropertyRefs DistributionLogNormalItem::distributionValues(bool /*withMean*/)
 {
     return {m_median, m_scaleParameter, m_sigmaFactor};
 }
@@ -386,10 +386,10 @@ void DistributionCosineItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Sigma, m_sigma);
 }
 
-DoubleDescriptors DistributionCosineItem::distributionValues(bool withMean)
+DoublePropertyRefs DistributionCosineItem::distributionValues(bool withMean)
 {
-    return withMean ? DoubleDescriptors{m_mean, m_sigma, m_sigmaFactor}
-                    : DoubleDescriptors{m_sigma, m_sigmaFactor};
+    return withMean ? DoublePropertyRefs{m_mean, m_sigma, m_sigmaFactor}
+                    : DoublePropertyRefs{m_sigma, m_sigmaFactor};
 }
 
 // --------------------------------------------------------------------------------------------- //
@@ -438,8 +438,8 @@ void DistributionTrapezoidItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::RightWidth, m_rightWidth);
 }
 
-DoubleDescriptors DistributionTrapezoidItem::distributionValues(bool withMean)
+DoublePropertyRefs DistributionTrapezoidItem::distributionValues(bool withMean)
 {
-    return withMean ? DoubleDescriptors{m_center, m_leftWidth, m_middleWidth, m_rightWidth}
-                    : DoubleDescriptors{m_leftWidth, m_middleWidth, m_rightWidth};
+    return withMean ? DoublePropertyRefs{m_center, m_leftWidth, m_middleWidth, m_rightWidth}
+                    : DoublePropertyRefs{m_leftWidth, m_middleWidth, m_rightWidth};
 }
diff --git a/GUI/Model/Descriptor/DistributionItems.h b/GUI/Model/Descriptor/DistributionItems.h
index b25ee975361..4f4d1e53134 100644
--- a/GUI/Model/Descriptor/DistributionItems.h
+++ b/GUI/Model/Descriptor/DistributionItems.h
@@ -56,7 +56,7 @@ public:
     //! to be set again by the owner of DistributionItem after reading it
     virtual void serialize(Streamer& s);
 
-    virtual DoubleDescriptors distributionValues(bool withMean = true) = 0;
+    virtual DoublePropertyRefs distributionValues(bool withMean = true) = 0;
 
 protected:
     void initSigmaFactor();
@@ -89,7 +89,7 @@ public:
     double deviation(double scale) const override;
     void initDistribution(double value) override;
 
-    DoubleDescriptors distributionValues(bool withMean = true) override;
+    DoublePropertyRefs distributionValues(bool withMean = true) override;
 };
 
 class DistributionGateItem : public DistributionItem {
@@ -106,7 +106,7 @@ public:
     void setRange(double min, double max);
 
     void serialize(Streamer& s) override;
-    DoubleDescriptors distributionValues(bool withMean = true) override;
+    DoublePropertyRefs distributionValues(bool withMean = true) override;
 };
 
 class DistributionLorentzItem : public SymmetricResolutionItem {
@@ -123,7 +123,7 @@ public:
     void initDistribution(double value) override;
 
     void serialize(Streamer& s) override;
-    DoubleDescriptors distributionValues(bool withMean = true) override;
+    DoublePropertyRefs distributionValues(bool withMean = true) override;
 };
 
 class DistributionGaussianItem : public SymmetricResolutionItem {
@@ -140,7 +140,7 @@ public:
     void initDistribution(double value) override;
     void serialize(Streamer& s) override;
 
-    DoubleDescriptors distributionValues(bool withMean = true) override;
+    DoublePropertyRefs distributionValues(bool withMean = true) override;
 };
 
 class DistributionLogNormalItem : public DistributionItem {
@@ -155,7 +155,7 @@ public:
     DOUBLE_PROPERTY(scaleParameter, ScaleParameter);
 
     void serialize(Streamer& s) override;
-    DoubleDescriptors distributionValues(bool withMean = true) override;
+    DoublePropertyRefs distributionValues(bool withMean = true) override;
 };
 
 class DistributionCosineItem : public SymmetricResolutionItem {
@@ -171,7 +171,7 @@ public:
     DOUBLE_PROPERTY(sigma, Sigma);
 
     void serialize(Streamer& s) override;
-    DoubleDescriptors distributionValues(bool withMean = true) override;
+    DoublePropertyRefs distributionValues(bool withMean = true) override;
 };
 
 class DistributionTrapezoidItem : public DistributionItem {
@@ -188,7 +188,7 @@ public:
     DOUBLE_PROPERTY(rightWidth, RightWidth);
 
     void serialize(Streamer& s) override;
-    DoubleDescriptors distributionValues(bool withMean = true) override;
+    DoublePropertyRefs distributionValues(bool withMean = true) override;
 };
 
 #endif // BORNAGAIN_GUI_MODEL_DESCRIPTOR_DISTRIBUTIONITEMS_H
diff --git a/GUI/Model/Descriptor/DoubleProperty.h b/GUI/Model/Descriptor/DoubleProperty.h
index 75afbbe419f..fafcfe567b0 100644
--- a/GUI/Model/Descriptor/DoubleProperty.h
+++ b/GUI/Model/Descriptor/DoubleProperty.h
@@ -30,17 +30,9 @@ class Streamer;
 //!   (e.g. Angstrom instead of nanometer)
 //! * decimals: how many decimals shall be shown in a spin box
 //! * limits: which limits shall be set in a spin box or other validator
-//! * persistent tag: a name to serialize this property. Do not change this tag if it was already
-//!   used for serialization, otherwise you may break backward compatibility of project reading.
 //! * uid: a unique id which represents this property. This is used for linking to this property,
-//!   also when serializing the link. Right now, this uid is a UUID. It could also be refactored and
-//!   changed to a simple (e.g. integer) id which is always unique throughout one project.
-//!
-//! This property class supports also the descriptor mechanism by directly returning a
-//! DoubleDescriptor. This descriptor contains all the relevant information taken from this class,
-//! and provides a getter and a setter to the contained value.
-//!
-//! \sa DoubleDescriptor
+//!   also when serializing the link. Right now, this uid is a UUID.
+
 class DoubleProperty {
 public:
     void init(const QString& label, const QString& tooltip, double value,
@@ -120,7 +112,6 @@ public:                                                                 \
 
 // clang-format on
 
-//using DoubleDescriptors = QList<DoubleDescriptor>;
-using DoubleDescriptors = QList<std::reference_wrapper<DoubleProperty>>;
+using DoublePropertyRefs = QList<std::reference_wrapper<DoubleProperty>>;
 
 #endif // BORNAGAIN_GUI_MODEL_DESCRIPTOR_DOUBLEPROPERTY_H
diff --git a/GUI/Model/Sample/FormFactorItems.h b/GUI/Model/Sample/FormFactorItems.h
index 5016e76cee5..eb86d1ff1bb 100644
--- a/GUI/Model/Sample/FormFactorItems.h
+++ b/GUI/Model/Sample/FormFactorItems.h
@@ -38,7 +38,7 @@ public:
 
 public:
     virtual std::unique_ptr<IFormFactor> createFormFactor() const = 0;
-    virtual DoubleDescriptors geometryValues() = 0;
+    virtual DoublePropertyRefs geometryValues() = 0;
     virtual void serialize(Streamer& s) = 0;
 };
 
@@ -52,7 +52,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(alpha, Alpha)
 
-    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height, m_alpha}; }
+    DoublePropertyRefs geometryValues() override { return {m_length, m_width, m_height, m_alpha}; }
     void serialize(Streamer& s) override;
 };
 
@@ -65,7 +65,7 @@ public:
     FF_PROPERTY(width, Width)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height}; }
+    DoublePropertyRefs geometryValues() override { return {m_length, m_width, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -78,7 +78,7 @@ public:
     FF_PROPERTY(width, Width)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height}; }
+    DoublePropertyRefs geometryValues() override { return {m_length, m_width, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -91,7 +91,7 @@ public:
     FF_PROPERTY(width, Width)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height}; }
+    DoublePropertyRefs geometryValues() override { return {m_length, m_width, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -104,7 +104,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(alpha, Alpha)
 
-    DoubleDescriptors geometryValues() override { return {m_radius, m_height, m_alpha}; }
+    DoublePropertyRefs geometryValues() override { return {m_radius, m_height, m_alpha}; }
     void serialize(Streamer& s) override;
 };
 
@@ -117,7 +117,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(alpha, Alpha)
 
-    DoubleDescriptors geometryValues() override { return {m_baseEdge, m_height, m_alpha}; }
+    DoublePropertyRefs geometryValues() override { return {m_baseEdge, m_height, m_alpha}; }
     void serialize(Streamer& s) override;
 };
 
@@ -131,7 +131,7 @@ public:
     FF_PROPERTY(heightRatio, HeightRatio)
     FF_PROPERTY(alpha, Alpha)
 
-    DoubleDescriptors geometryValues() override
+    DoublePropertyRefs geometryValues() override
     {
         return {m_length, m_height, m_heightRatio, m_alpha};
     }
@@ -146,7 +146,7 @@ public:
     FF_PROPERTY(radius, Radius)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() override { return {m_radius, m_height}; }
+    DoublePropertyRefs geometryValues() override { return {m_radius, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -159,7 +159,7 @@ public:
     FF_PROPERTY(radiusY, RadiusY)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() override { return {m_radiusX, m_radiusY, m_height}; }
+    DoublePropertyRefs geometryValues() override { return {m_radiusX, m_radiusY, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -170,7 +170,7 @@ public:
 
     FF_PROPERTY(radius, Radius)
 
-    DoubleDescriptors geometryValues() override { return {m_radius}; }
+    DoublePropertyRefs geometryValues() override { return {m_radius}; }
     void serialize(Streamer& s) override;
 };
 
@@ -182,7 +182,7 @@ public:
     FF_PROPERTY(radius, Radius)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() override { return {m_radius, m_height}; }
+    DoublePropertyRefs geometryValues() override { return {m_radius, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -195,7 +195,7 @@ public:
     FF_PROPERTY(radiusY, RadiusY)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() override { return {m_radiusX, m_radiusY, m_height}; }
+    DoublePropertyRefs geometryValues() override { return {m_radiusX, m_radiusY, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -207,7 +207,7 @@ public:
     FF_PROPERTY(baseEdge, BaseEdge)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() override { return {m_baseEdge, m_height}; }
+    DoublePropertyRefs geometryValues() override { return {m_baseEdge, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -219,7 +219,7 @@ public:
     FF_PROPERTY(baseEdge, BaseEdge)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() override { return {m_baseEdge, m_height}; }
+    DoublePropertyRefs geometryValues() override { return {m_baseEdge, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -232,7 +232,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(alpha, Alpha)
 
-    DoubleDescriptors geometryValues() override { return {m_baseEdge, m_height, m_alpha}; }
+    DoublePropertyRefs geometryValues() override { return {m_baseEdge, m_height, m_alpha}; }
     void serialize(Streamer& s) override;
 };
 
@@ -245,7 +245,7 @@ public:
     FF_PROPERTY(width, Width)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height}; }
+    DoublePropertyRefs geometryValues() override { return {m_length, m_width, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -258,7 +258,7 @@ public:
     FF_PROPERTY(width, Width)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height}; }
+    DoublePropertyRefs geometryValues() override { return {m_length, m_width, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -271,7 +271,7 @@ public:
     FF_PROPERTY(width, Width)
     FF_PROPERTY(height, Height)
 
-    DoubleDescriptors geometryValues() override { return {m_length, m_width, m_height}; }
+    DoublePropertyRefs geometryValues() override { return {m_length, m_width, m_height}; }
     void serialize(Streamer& s) override;
 };
 
@@ -285,7 +285,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(asymmetry, Asymmetry)
 
-    DoubleDescriptors geometryValues() override
+    DoublePropertyRefs geometryValues() override
     {
         return {m_length, m_width, m_height, m_asymmetry};
     }
@@ -302,7 +302,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(asymmetry, Asymmetry)
 
-    DoubleDescriptors geometryValues() override
+    DoublePropertyRefs geometryValues() override
     {
         return {m_length, m_width, m_height, m_asymmetry};
     }
@@ -319,7 +319,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(asymmetry, Asymmetry)
 
-    DoubleDescriptors geometryValues() override
+    DoublePropertyRefs geometryValues() override
     {
         return {m_length, m_width, m_height, m_asymmetry};
     }
@@ -335,7 +335,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(alpha, Alpha)
 
-    DoubleDescriptors geometryValues() override { return {m_baseEdge, m_height, m_alpha}; }
+    DoublePropertyRefs geometryValues() override { return {m_baseEdge, m_height, m_alpha}; }
     void serialize(Streamer& s) override;
 };
 
@@ -347,7 +347,7 @@ public:
     FF_PROPERTY(length, Length)
     FF_PROPERTY(removedLength, RemovedLength)
 
-    DoubleDescriptors geometryValues() override { return {m_length, m_removedLength}; }
+    DoublePropertyRefs geometryValues() override { return {m_length, m_removedLength}; }
     void serialize(Streamer& s) override;
 };
 
@@ -360,7 +360,7 @@ public:
     FF_PROPERTY(height, Height)
     FF_PROPERTY(removedTop, RemovedTop)
 
-    DoubleDescriptors geometryValues() override { return {m_radius, m_height, m_removedTop}; }
+    DoublePropertyRefs geometryValues() override { return {m_radius, m_height, m_removedTop}; }
     void serialize(Streamer& s) override;
 };
 
@@ -374,7 +374,7 @@ public:
     FF_PROPERTY(heightFlattening, HeightFlattening)
     FF_PROPERTY(removedTop, RemovedTop)
 
-    DoubleDescriptors geometryValues() override
+    DoublePropertyRefs geometryValues() override
     {
         return {m_radius, m_height, m_heightFlattening, m_removedTop};
     }
@@ -389,7 +389,7 @@ public:
     FF_PROPERTY(length, Length)
     FF_PROPERTY(removedLength, RemovedLength)
 
-    DoubleDescriptors geometryValues() override { return {m_length, m_removedLength}; }
+    DoublePropertyRefs geometryValues() override { return {m_length, m_removedLength}; }
     void serialize(Streamer& s) override;
 };
 
@@ -403,7 +403,7 @@ public:
     FF_PROPERTY(sliceBottom, SliceBottom)
     FF_PROPERTY(sliceTop, SliceTop)
 
-    DoubleDescriptors geometryValues() override
+    DoublePropertyRefs geometryValues() override
     {
         return {m_radius, m_length, m_sliceBottom, m_sliceTop};
     }
@@ -416,7 +416,7 @@ class PlatonicItem : public FormFactorItem {
 public:
     FF_PROPERTY(edge, Edge)
 
-    DoubleDescriptors geometryValues() override { return {m_edge}; }
+    DoublePropertyRefs geometryValues() override { return {m_edge}; }
     void serialize(Streamer& s) override;
 };
 
diff --git a/GUI/Model/Sample/Lattice2DItems.h b/GUI/Model/Sample/Lattice2DItems.h
index 8254bfc2d2a..a6b36bb9261 100644
--- a/GUI/Model/Sample/Lattice2DItems.h
+++ b/GUI/Model/Sample/Lattice2DItems.h
@@ -30,7 +30,7 @@ protected:
 public:
     virtual ~Lattice2DItem() = default;
     virtual std::unique_ptr<Lattice2D> createLattice() const = 0;
-    virtual DoubleDescriptors geometryValues(bool withRotationAngle) = 0;
+    virtual DoublePropertyRefs geometryValues(bool withRotationAngle) = 0;
     virtual void serialize(Streamer& s) = 0;
     double unitCellArea() const;
 
@@ -48,7 +48,7 @@ public:
     BasicLattice2DItem();
     std::unique_ptr<Lattice2D> createLattice() const override;
     void serialize(Streamer& s) override;
-    DoubleDescriptors geometryValues(bool withRotationAngle) override
+    DoublePropertyRefs geometryValues(bool withRotationAngle) override
     {
         if (withRotationAngle)
             return {m_length1, m_length2, m_angle, m_latticeRotationAngle};
@@ -72,7 +72,7 @@ public:
     SquareLattice2DItem();
     std::unique_ptr<Lattice2D> createLattice() const override;
     void serialize(Streamer& s) override;
-    DoubleDescriptors geometryValues(bool withRotationAngle) override
+    DoublePropertyRefs geometryValues(bool withRotationAngle) override
     {
         if (withRotationAngle)
             return {m_length, m_latticeRotationAngle};
@@ -92,7 +92,7 @@ public:
     HexagonalLattice2DItem();
     std::unique_ptr<Lattice2D> createLattice() const override;
     void serialize(Streamer& s) override;
-    DoubleDescriptors geometryValues(bool withRotationAngle) override
+    DoublePropertyRefs geometryValues(bool withRotationAngle) override
     {
         if (withRotationAngle)
             return {m_length, m_latticeRotationAngle};
diff --git a/GUI/Model/Sample/ProfileItems.cpp b/GUI/Model/Sample/ProfileItems.cpp
index df0c4293541..b279f320ec1 100644
--- a/GUI/Model/Sample/ProfileItems.cpp
+++ b/GUI/Model/Sample/ProfileItems.cpp
@@ -39,7 +39,7 @@ void Profile1DItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Omega, m_omega);
 }
 
-DoubleDescriptors Profile1DItem::valueDescriptors()
+DoublePropertyRefs Profile1DItem::valueDescriptors()
 {
     return {m_omega};
 }
@@ -99,9 +99,9 @@ void Profile1DVoigtItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Eta, m_eta);
 }
 
-DoubleDescriptors Profile1DVoigtItem::valueDescriptors()
+DoublePropertyRefs Profile1DVoigtItem::valueDescriptors()
 {
-    return Profile1DItem::valueDescriptors() + DoubleDescriptors{m_eta};
+    return Profile1DItem::valueDescriptors() + DoublePropertyRefs{m_eta};
 }
 
 // --------------------------------------------------------------------------------------------- //
@@ -126,7 +126,7 @@ void Profile2DItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Gamma, m_gamma);
 }
 
-DoubleDescriptors Profile2DItem::valueDescriptors()
+DoublePropertyRefs Profile2DItem::valueDescriptors()
 {
     return {m_omegaX, m_omegaY, m_gamma};
 }
@@ -186,7 +186,7 @@ void Profile2DVoigtItem::serialize(Streamer& s)
     Serialize::rwProperty(s, Tag::Eta, m_eta);
 }
 
-DoubleDescriptors Profile2DVoigtItem::valueDescriptors()
+DoublePropertyRefs Profile2DVoigtItem::valueDescriptors()
 {
     return {m_omegaX, m_omegaY, m_eta, m_gamma};
 }
diff --git a/GUI/Model/Sample/ProfileItems.h b/GUI/Model/Sample/ProfileItems.h
index efef7dbf93a..c90bb1ed045 100644
--- a/GUI/Model/Sample/ProfileItems.h
+++ b/GUI/Model/Sample/ProfileItems.h
@@ -33,7 +33,7 @@ public:
     double omega() const { return m_omega.get(); }
     void setOmega(double v) { m_omega.set(v); }
 
-    virtual DoubleDescriptors valueDescriptors();
+    virtual DoublePropertyRefs valueDescriptors();
 
 protected:
     Profile1DItem();
@@ -74,7 +74,7 @@ public:
 
     void setEta(double v) { m_eta.set(v); }
 
-    DoubleDescriptors valueDescriptors() override;
+    DoublePropertyRefs valueDescriptors() override;
 
 private:
     DoubleProperty m_eta;
@@ -92,7 +92,7 @@ public:
     void setOmegaY(double v) { m_omegaY.set(v); }
     void setGamma(double v) { m_gamma.set(v); }
 
-    virtual DoubleDescriptors valueDescriptors();
+    virtual DoublePropertyRefs valueDescriptors();
 
 protected:
     Profile2DItem();
@@ -130,7 +130,7 @@ public:
 
     void setEta(double v) { m_eta.set(v); }
 
-    DoubleDescriptors valueDescriptors() override;
+    DoublePropertyRefs valueDescriptors() override;
 
 private:
     DoubleProperty m_eta;
diff --git a/GUI/Model/Sample/RotationItems.h b/GUI/Model/Sample/RotationItems.h
index 81762926005..ec3318b441a 100644
--- a/GUI/Model/Sample/RotationItems.h
+++ b/GUI/Model/Sample/RotationItems.h
@@ -29,7 +29,7 @@ public:
     RotMatrix rotation() const;
 
     virtual void serialize(Streamer& s) = 0;
-    virtual DoubleDescriptors rotationValues() = 0;
+    virtual DoublePropertyRefs rotationValues() = 0;
 
 protected:
     RotationItem();
@@ -39,7 +39,7 @@ protected:
 class XYZRotationItem : public RotationItem {
 public:
     void serialize(Streamer& s) override;
-    DoubleDescriptors rotationValues() override { return {m_angle}; };
+    DoublePropertyRefs rotationValues() override { return {m_angle}; };
 
     void setAngle(double v) { m_angle.set(v); }
 
@@ -75,7 +75,7 @@ class EulerRotationItem : public RotationItem {
 public:
     EulerRotationItem();
     void serialize(Streamer& s) override;
-    DoubleDescriptors rotationValues() override { return {m_alpha, m_beta, m_gamma}; };
+    DoublePropertyRefs rotationValues() override { return {m_alpha, m_beta, m_gamma}; };
 
     void setAlpha(double v) { m_alpha.set(v); }
     void setBeta(double v) { m_beta.set(v); }
diff --git a/GUI/View/SampleDesigner/FormLayouter.cpp b/GUI/View/SampleDesigner/FormLayouter.cpp
index 4c603a11c52..2e43a3223cf 100644
--- a/GUI/View/SampleDesigner/FormLayouter.cpp
+++ b/GUI/View/SampleDesigner/FormLayouter.cpp
@@ -73,7 +73,7 @@ void FormLayouter::insertRow(int row, QString label, QWidget* w)
     m_formLayout->insertRow(row, LayerEditorUtils::createBoldLabel(label), w);
 }
 
-int FormLayouter::addGroupOfValues(const QString& labelText, const DoubleDescriptors& values)
+int FormLayouter::addGroupOfValues(const QString& labelText, const DoublePropertyRefs& values)
 {
     auto* w = new QWidget(m_formLayout->parentWidget());
     w->setObjectName("PropertyBaseWidget");
diff --git a/GUI/View/SampleDesigner/FormLayouter.h b/GUI/View/SampleDesigner/FormLayouter.h
index f6d6606fd3f..dfcc83fbacf 100644
--- a/GUI/View/SampleDesigner/FormLayouter.h
+++ b/GUI/View/SampleDesigner/FormLayouter.h
@@ -124,7 +124,7 @@ public:
     //! space to the right. For the creation, signaling, unit handling etc. of one DoubleProperty
     //! the same applies as when adding a single DoubleProperty with the method addValue(),
     //! therefore please read there for more details. Returns the newly added row.
-    int addGroupOfValues(const QString& labelText, const DoubleDescriptors& values);
+    int addGroupOfValues(const QString& labelText, const DoublePropertyRefs& values);
 
     //! Adds a row with a bold printed label and the 3 values of a 3D vector.
     //!
diff --git a/GUI/View/SampleDesigner/LayerEditorUtils.cpp b/GUI/View/SampleDesigner/LayerEditorUtils.cpp
index 4a62eeee2a7..b99cdaa2c71 100644
--- a/GUI/View/SampleDesigner/LayerEditorUtils.cpp
+++ b/GUI/View/SampleDesigner/LayerEditorUtils.cpp
@@ -65,7 +65,7 @@ void LayerEditorUtils::updateLabelUnit(QLabel* label)
 }
 
 void LayerEditorUtils::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol,
-                                              const DoubleDescriptors& valueDescriptors,
+                                              const DoublePropertyRefs& valueDescriptors,
                                               SampleEditorController* ec, bool vertically,
                                               bool addSpacer)
 {
@@ -78,7 +78,7 @@ void LayerEditorUtils::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int fir
 }
 
 void LayerEditorUtils::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol,
-                                              const DoubleDescriptors& valueDescriptors,
+                                              const DoublePropertyRefs& valueDescriptors,
                                               function<void(double, DoubleDescriptor)> setNewValue,
                                               bool vertically, bool addSpacer)
 {
@@ -114,7 +114,7 @@ void LayerEditorUtils::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int fir
 }
 
 void LayerEditorUtils::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol,
-                                              const DoubleDescriptors& valueDescriptors,
+                                              const DoublePropertyRefs& valueDescriptors,
                                               SampleEditorController* ec, bool addSpacer)
 {
     addMultiPropertyToGrid(m_gridLayout, firstCol, valueDescriptors, ec,
@@ -148,7 +148,7 @@ QLabel* LayerEditorUtils::createBoldLabel(const QString& text)
     return l;
 }
 
-DoubleDescriptors LayerEditorUtils::doubleDescriptorsOfItem(RotationItem* item)
+DoublePropertyRefs LayerEditorUtils::doubleDescriptorsOfItem(RotationItem* item)
 {
     if (!item)
         return {};
@@ -156,22 +156,22 @@ DoubleDescriptors LayerEditorUtils::doubleDescriptorsOfItem(RotationItem* item)
     return item->rotationValues();
 }
 
-DoubleDescriptors LayerEditorUtils::doubleDescriptorsOfItem(Profile2DItem* item)
+DoublePropertyRefs LayerEditorUtils::doubleDescriptorsOfItem(Profile2DItem* item)
 {
     return item->valueDescriptors();
 }
 
-DoubleDescriptors LayerEditorUtils::doubleDescriptorsOfItem(Profile1DItem* item)
+DoublePropertyRefs LayerEditorUtils::doubleDescriptorsOfItem(Profile1DItem* item)
 {
     return item->valueDescriptors();
 }
 
-DoubleDescriptors LayerEditorUtils::doubleDescriptorsOfItem(FormFactorItem* item)
+DoublePropertyRefs LayerEditorUtils::doubleDescriptorsOfItem(FormFactorItem* item)
 {
     return item->geometryValues();
 }
 
-DoubleDescriptors LayerEditorUtils::doubleDescriptorsOfItem(LayerBasicRoughnessItem* r)
+DoublePropertyRefs LayerEditorUtils::doubleDescriptorsOfItem(LayerBasicRoughnessItem* r)
 {
     if (r)
         return {r->sigma(), r->hurst(), r->lateralCorrelationLength()};
diff --git a/GUI/View/SampleDesigner/LayerEditorUtils.h b/GUI/View/SampleDesigner/LayerEditorUtils.h
index aab6925c39d..59655d11e45 100644
--- a/GUI/View/SampleDesigner/LayerEditorUtils.h
+++ b/GUI/View/SampleDesigner/LayerEditorUtils.h
@@ -46,17 +46,17 @@ void updateLabelUnit(QLabel* label, DoubleSpinBox* editor);
 //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to
 //! SampleEditorController::setDouble()
 void addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol,
-                            const DoubleDescriptors& valueDescriptors, SampleEditorController* ec,
+                            const DoublePropertyRefs& valueDescriptors, SampleEditorController* ec,
                             bool vertically, bool addSpacer);
 
 //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to the given setNewValue()
 void addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol,
-                            const DoubleDescriptors& valueDescriptors,
+                            const DoublePropertyRefs& valueDescriptors,
                             std::function<void(double, DoubleDescriptor)> setNewValue,
                             bool vertically, bool addSpacer);
 
 void addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol,
-                            const DoubleDescriptors& valueDescriptors, SampleEditorController* ec,
+                            const DoublePropertyRefs& valueDescriptors, SampleEditorController* ec,
                             bool addSpacer);
 
 //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to
@@ -72,11 +72,11 @@ void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty &v,
 
 QLabel* createBoldLabel(const QString& text);
 
-DoubleDescriptors doubleDescriptorsOfItem(LayerBasicRoughnessItem* item);
-DoubleDescriptors doubleDescriptorsOfItem(FormFactorItem* item);
-DoubleDescriptors doubleDescriptorsOfItem(Profile1DItem* item);
-DoubleDescriptors doubleDescriptorsOfItem(Profile2DItem* item);
-DoubleDescriptors doubleDescriptorsOfItem(RotationItem* item);
+DoublePropertyRefs doubleDescriptorsOfItem(LayerBasicRoughnessItem* item);
+DoublePropertyRefs doubleDescriptorsOfItem(FormFactorItem* item);
+DoublePropertyRefs doubleDescriptorsOfItem(Profile1DItem* item);
+DoublePropertyRefs doubleDescriptorsOfItem(Profile2DItem* item);
+DoublePropertyRefs doubleDescriptorsOfItem(RotationItem* item);
 
 QWidget* createWidgetForItemWithParticles(QWidget* parentWidget,
                                           ItemWithParticles* itemWithParticles, bool allowAbundance,
diff --git a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp
index 75c0ed5fec8..442f957f0ef 100644
--- a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp
+++ b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp
@@ -92,7 +92,7 @@ void MaterialInplaceForm::createWidgets()
     ASSERT(material);
 
     // -- Create UI for delta/beta resp. sldRe/sldIm
-    DoubleDescriptors values;
+    DoublePropertyRefs values;
     if (material->hasRefractiveIndex())
         values << material->delta() << material->beta();
     else
diff --git a/GUI/View/SampleDesigner/SelectionContainerForm.h b/GUI/View/SampleDesigner/SelectionContainerForm.h
index 482c36dd271..4b4880af9d3 100644
--- a/GUI/View/SampleDesigner/SelectionContainerForm.h
+++ b/GUI/View/SampleDesigner/SelectionContainerForm.h
@@ -109,7 +109,7 @@ public:
                 return LayerEditorUtils::doubleDescriptorsOfItem(d.currentItem());
             };
         else
-            currentValues = [] { return DoubleDescriptors(); };
+            currentValues = [] { return DoublePropertyRefs(); };
 
         initUI(d);
     }
@@ -121,7 +121,7 @@ public:
     }
 
 private:
-    std::function<DoubleDescriptors()> currentValues = nullptr;
+    std::function<DoublePropertyRefs()> currentValues = nullptr;
 };
 
 #endif // BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SELECTIONCONTAINERFORM_H
-- 
GitLab


From 5478cf1ff5feb9f2ade70cd8e03f95caab343efe Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Wed, 30 Nov 2022 17:52:41 +0100
Subject: [PATCH 13/13] clang-format

---
 GUI/Model/Model/ParameterTreeUtils.cpp       |  3 +--
 GUI/Model/Model/ParameterTreeUtils.h         |  4 ++--
 GUI/View/SampleDesigner/FormLayouter.cpp     |  7 +++----
 GUI/View/SampleDesigner/FormLayouter.h       | 14 +++++++-------
 GUI/View/SampleDesigner/LayerEditorUtils.cpp |  8 +++-----
 GUI/View/SampleDesigner/LayerEditorUtils.h   |  2 +-
 6 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/GUI/Model/Model/ParameterTreeUtils.cpp b/GUI/Model/Model/ParameterTreeUtils.cpp
index bb3913bb7ea..45a3689bcd1 100644
--- a/GUI/Model/Model/ParameterTreeUtils.cpp
+++ b/GUI/Model/Model/ParameterTreeUtils.cpp
@@ -228,8 +228,7 @@ void ParameterTreeBuilder::addInterference(ParameterLabelItem* layoutLabel,
         auto* dfLabel = addLabel<Profile2DItemCatalog>(label, "Decay function", df);
         for (const auto& d : df->valueDescriptors())
             addParameterItem(dfLabel, d);
-    } else if (auto* itf =
-                   dynamic_cast<InterferenceFinite2DLatticeItem*>(interference)) {
+    } else if (auto* itf = dynamic_cast<InterferenceFinite2DLatticeItem*>(interference)) {
         // domainSize1 and domainSize2 are of type UInt (not matching the double approach for tuning
         // and fitting). In BornAgain 1.18 these values have not been added to the tuning tree, and
         // also not to the fitting parameters. Maybe this should be necessary, but for now this
diff --git a/GUI/Model/Model/ParameterTreeUtils.h b/GUI/Model/Model/ParameterTreeUtils.h
index 1cb2db931d6..3ee62be724d 100644
--- a/GUI/Model/Model/ParameterTreeUtils.h
+++ b/GUI/Model/Model/ParameterTreeUtils.h
@@ -54,7 +54,7 @@ private:
     void addInstrument();
     void addParameterItem(ParameterLabelItem* parent, DoubleProperty& d,
                           const QString& label = QString());
-    void addParameterItem(ParameterLabelItem* parent, VectorProperty &d);
+    void addParameterItem(ParameterLabelItem* parent, VectorProperty& d);
     ParameterContainerItem* parameterContainer();
     bool allowMagneticFields() const;
 
@@ -72,7 +72,7 @@ private:
 
     void addDetector(ParameterLabelItem* parentLabel, DetectorItem* detector);
     void addBackground(ParameterLabelItem* instrumentLabel, BackgroundItem* backgroundItem);
-    void addPolarization(ParameterLabelItem* instrumentLabel, InstrumentItem *instrument);
+    void addPolarization(ParameterLabelItem* instrumentLabel, InstrumentItem* instrument);
 
 private:
     JobItem* m_jobItem;
diff --git a/GUI/View/SampleDesigner/FormLayouter.cpp b/GUI/View/SampleDesigner/FormLayouter.cpp
index 2e43a3223cf..790a3ddbd27 100644
--- a/GUI/View/SampleDesigner/FormLayouter.cpp
+++ b/GUI/View/SampleDesigner/FormLayouter.cpp
@@ -129,13 +129,13 @@ void FormLayouter::addStructureEditingRow(QPushButton* button)
     addRow(w);
 }
 
-int FormLayouter::addValue(DoubleProperty &d)
+int FormLayouter::addValue(DoubleProperty& d)
 {
     insertValue(m_formLayout->rowCount(), d);
     return m_formLayout->rowCount() - 1;
 }
 
-int FormLayouter::addValue(DoubleProperty &d, function<void(double)> onValueChange)
+int FormLayouter::addValue(DoubleProperty& d, function<void(double)> onValueChange)
 {
     insertValue(m_formLayout->rowCount(), d, onValueChange);
     return m_formLayout->rowCount() - 1;
@@ -147,8 +147,7 @@ void FormLayouter::insertValue(int row, DoubleProperty& d)
     insertValue(row, d, [ec, d](double newValue) { ec->setDouble(newValue, d); });
 }
 
-void FormLayouter::insertValue(int row, DoubleProperty &d,
-                               function<void(double)> onValueChange)
+void FormLayouter::insertValue(int row, DoubleProperty& d, function<void(double)> onValueChange)
 {
     auto labelText = d.label();
     if (!labelText.endsWith(":"))
diff --git a/GUI/View/SampleDesigner/FormLayouter.h b/GUI/View/SampleDesigner/FormLayouter.h
index dfcc83fbacf..2d19425d122 100644
--- a/GUI/View/SampleDesigner/FormLayouter.h
+++ b/GUI/View/SampleDesigner/FormLayouter.h
@@ -28,9 +28,9 @@ class VectorProperty;
 
 //! Utility class to populate a QFormLayout.
 //!
-//! Helps to add edit controls which operate on Properties (DoubleProperty, VectorProperty, SelectionProperty).
-//! Also takes care of bold printed labels, the connection of labels and edit controls
-//! (buddies), which is necessary to realize the "label shows unit of value" feature.
+//! Helps to add edit controls which operate on Properties (DoubleProperty, VectorProperty,
+//! SelectionProperty). Also takes care of bold printed labels, the connection of labels and edit
+//! controls (buddies), which is necessary to realize the "label shows unit of value" feature.
 //! Connections to a given SampleEditorController are established as well.
 class FormLayouter {
 public:
@@ -108,7 +108,7 @@ public:
     //! Inserts a row with a bold printed label and a DoubleSpinBox.
     //!
     //! Same functionality as addValue(), please read there.
-    void insertValue(int row, DoubleProperty &d);
+    void insertValue(int row, DoubleProperty& d);
 
     //! Inserts a row with a bold printed label and a DoubleSpinBox.
     //!
@@ -117,8 +117,8 @@ public:
 
     //! Adds a row with a bold printed label and a set of DoubleDescriptors.
     //!
-    //! The label describes the set of the DoubleProperties and is located in the first column of the
-    //! layout. The DoubleSpinBoxes for each DoubleProperty are created as children of a newly
+    //! The label describes the set of the DoubleProperties and is located in the first column of
+    //! the layout. The DoubleSpinBoxes for each DoubleProperty are created as children of a newly
     //! created widget, which is positioned in the second column of the layout. If the number of
     //! values is greater than 1, the related labels are shown above them, to limit the necessary
     //! space to the right. For the creation, signaling, unit handling etc. of one DoubleProperty
@@ -132,7 +132,7 @@ public:
     //! In addition, the caller can define whether the labels are above the values
     //! (vertically=true), or whether labels and values are all placed in one row
     //! (vertically=false).
-    int addVector(VectorProperty &d, bool vertically = true);
+    int addVector(VectorProperty& d, bool vertically = true);
 
     //! Shows or hides the widgets in a row.
     void setRowVisible(int row, bool visible);
diff --git a/GUI/View/SampleDesigner/LayerEditorUtils.cpp b/GUI/View/SampleDesigner/LayerEditorUtils.cpp
index b99cdaa2c71..a09dbc19dc9 100644
--- a/GUI/View/SampleDesigner/LayerEditorUtils.cpp
+++ b/GUI/View/SampleDesigner/LayerEditorUtils.cpp
@@ -121,17 +121,15 @@ void LayerEditorUtils::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int fir
                            valueDescriptors.size() > 1, addSpacer);
 }
 
-void LayerEditorUtils::addVectorToGrid(QGridLayout* m_gridLayout, int firstCol,
-                                       VectorProperty &v, SampleEditorController* ec,
-                                       bool vertically, bool addSpacer)
+void LayerEditorUtils::addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v,
+                                       SampleEditorController* ec, bool vertically, bool addSpacer)
 {
     addMultiPropertyToGrid(m_gridLayout, firstCol, {v.x(), v.y(), v.z()}, ec, vertically,
                            addSpacer);
 }
 
 
-void LayerEditorUtils::addVectorToGrid(QGridLayout* m_gridLayout, int firstCol,
-                                       VectorProperty& v,
+void LayerEditorUtils::addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v,
                                        function<void(double, DoubleDescriptor)> setNewValue,
                                        bool vertically, bool addSpacer)
 {
diff --git a/GUI/View/SampleDesigner/LayerEditorUtils.h b/GUI/View/SampleDesigner/LayerEditorUtils.h
index 59655d11e45..383a9b24754 100644
--- a/GUI/View/SampleDesigner/LayerEditorUtils.h
+++ b/GUI/View/SampleDesigner/LayerEditorUtils.h
@@ -65,7 +65,7 @@ void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v,
                      SampleEditorController* ec, bool vertically, bool addSpacer);
 
 //! Create DoubleSpinBoxes for the DoubeDescriptors and connect them to the given setNewValue()
-void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty &v,
+void addVectorToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v,
                      std::function<void(double, DoubleDescriptor)> setNewValue, bool vertically,
                      bool addSpacer);
 
-- 
GitLab