From a78e80092764f963b1b14dd334a7c061f3835a3f Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Wed, 25 Oct 2023 17:57:44 +0200
Subject: [PATCH] inline LayerEditorUtil::addMagnetizationToGrid

---
 GUI/View/SampleDesigner/LayerEditorUtil.cpp     | 13 -------------
 GUI/View/SampleDesigner/LayerEditorUtil.h       |  4 ----
 GUI/View/SampleDesigner/MaterialInplaceForm.cpp | 10 ++++++----
 3 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/GUI/View/SampleDesigner/LayerEditorUtil.cpp b/GUI/View/SampleDesigner/LayerEditorUtil.cpp
index 7083a5384cc..64b97ecfb91 100644
--- a/GUI/View/SampleDesigner/LayerEditorUtil.cpp
+++ b/GUI/View/SampleDesigner/LayerEditorUtil.cpp
@@ -100,19 +100,6 @@ void LayerEditorUtil::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firs
                            addSpacer);
 }
 
-void LayerEditorUtil::addMagnetizationToGrid(
-    QGridLayout* m_gridLayout, int firstCol, VectorProperty& v,
-    std::function<void(double, DoubleProperty&)> setNewValue, bool vertically, bool addSpacer,
-    bool with_z)
-{
-    if (with_z)
-        addMultiPropertyToGrid(m_gridLayout, firstCol, {&v.x(), &v.y(), &v.z()}, setNewValue,
-                               vertically, addSpacer);
-    else
-        addMultiPropertyToGrid(m_gridLayout, firstCol, {&v.x(), &v.y()}, setNewValue, vertically,
-                               addSpacer);
-}
-
 QWidget* LayerEditorUtil::createWidgetForItemWithParticles(QWidget* parentWidget,
                                                            ItemWithParticles* itemWithParticles,
                                                            bool allowAbundance,
diff --git a/GUI/View/SampleDesigner/LayerEditorUtil.h b/GUI/View/SampleDesigner/LayerEditorUtil.h
index 2f1c8601c07..b9904a474d2 100644
--- a/GUI/View/SampleDesigner/LayerEditorUtil.h
+++ b/GUI/View/SampleDesigner/LayerEditorUtil.h
@@ -54,10 +54,6 @@ void addMultiPropertyToGrid(QGridLayout* m_gridLayout, int firstCol,
                             const DoubleProperties& valueProperties, SampleEditorController* ec,
                             bool addSpacer);
 
-void addMagnetizationToGrid(QGridLayout* m_gridLayout, int firstCol, VectorProperty& v,
-                            std::function<void(double, DoubleProperty&)> setNewValue,
-                            bool vertically, bool addSpacer, bool with_z);
-
 QWidget* createWidgetForItemWithParticles(QWidget* parentWidget,
                                           ItemWithParticles* itemWithParticles, bool allowAbundance,
                                           SampleEditorController* ec, bool allowRemove = true);
diff --git a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp
index 62c3b389c70..0844a698edd 100644
--- a/GUI/View/SampleDesigner/MaterialInplaceForm.cpp
+++ b/GUI/View/SampleDesigner/MaterialInplaceForm.cpp
@@ -120,12 +120,14 @@ void MaterialInplaceForm::createWidgets()
 
     // Processing z-magnetization is not implemented yet (see issue #654)
     const LayerItem* layer_item = dynamic_cast<LayerItem*>(m_item);
+    VectorProperty& v = material->magnetization();
     if (layer_item && !layer_item->isTopLayer())
-        LayerEditorUtil::addMagnetizationToGrid(m_layout, col, material->magnetization(),
-                                                setNewValue, true, false, false);
+        LayerEditorUtil::addMultiPropertyToGrid(m_layout, col, {&v.x(), &v.y()}, setNewValue, true,
+                                                false);
+
     if (!layer_item)
-        LayerEditorUtil::addMagnetizationToGrid(m_layout, col, material->magnetization(),
-                                                setNewValue, true, false, true);
+        LayerEditorUtil::addMultiPropertyToGrid(m_layout, col, {&v.x(), &v.y(), &v.z()},
+                                                setNewValue, true, false);
 
     // -- Create UI for material selection button
     auto* btn = new QPushButton("...", this);
-- 
GitLab