Skip to content
Snippets Groups Projects
Commit 81fab737 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

ditto compound

parent 3b37d90a
No related branches found
No related tags found
1 merge request!2067Replace FormLayouter by HeinzFormLayout, which inherits from QFormLayout. Resolve crash in sample view (#808)
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "GUI/View/SampleDesigner/CompoundForm.h" #include "GUI/View/SampleDesigner/CompoundForm.h"
#include "GUI/Model/Sample/CompoundItem.h" #include "GUI/Model/Sample/CompoundItem.h"
#include "GUI/Support/Util/ActionFactory.h" #include "GUI/Support/Util/ActionFactory.h"
#include "GUI/View/SampleDesigner/FormLayouter.h" #include "GUI/View/SampleDesigner/HeinzFormLayout.h"
#include "GUI/View/SampleDesigner/LayerEditorUtil.h" #include "GUI/View/SampleDesigner/LayerEditorUtil.h"
#include <QAction> #include <QAction>
#include <QPushButton> #include <QPushButton>
...@@ -26,15 +26,15 @@ CompoundForm::CompoundForm(QWidget* parent, CompoundItem* compoundItem, SampleEd ...@@ -26,15 +26,15 @@ CompoundForm::CompoundForm(QWidget* parent, CompoundItem* compoundItem, SampleEd
, m_compositionItem(compoundItem) , m_compositionItem(compoundItem)
, m_ec(ec) , m_ec(ec)
{ {
FormLayouter layouter(this, ec); m_layout = new HeinzFormLayout(this, ec);
layouter.setContentsMargins(30, 6, 0, 0); body()->setLayout(m_layout);
layouter.addVector(compoundItem->position(), false); m_layout->setContentsMargins(30, 6, 0, 0);
layouter.addSelection(compoundItem->rotationSelection()); m_layout->addVector(compoundItem->position(), false);
layouter.addValue(compoundItem->abundance()); m_layout->addSelection(compoundItem->rotationSelection());
body()->setLayout(layouter.layout()); m_layout->addValue(compoundItem->abundance());
for (auto* particle : compoundItem->itemsWithParticles()) for (auto* particle : compoundItem->itemsWithParticles())
layouter.addRow( m_layout->addRow(
LayerEditorUtil::createWidgetForItemWithParticles(this, particle, false, ec)); LayerEditorUtil::createWidgetForItemWithParticles(this, particle, false, ec));
auto* btn = LayerEditorUtil::createAddParticleButton( auto* btn = LayerEditorUtil::createAddParticleButton(
...@@ -42,7 +42,7 @@ CompoundForm::CompoundForm(QWidget* parent, CompoundItem* compoundItem, SampleEd ...@@ -42,7 +42,7 @@ CompoundForm::CompoundForm(QWidget* parent, CompoundItem* compoundItem, SampleEd
[=](ItemWithParticlesCatalog::Type type) { ec->addCompoundItem(compoundItem, type); }); [=](ItemWithParticlesCatalog::Type type) { ec->addCompoundItem(compoundItem, type); });
m_structureEditingWidgets << btn; m_structureEditingWidgets << btn;
layouter.addStructureEditingRow(btn); m_layout->addStructureEditingRow(btn);
// top right corner actions // top right corner actions
// show in real space // show in real space
...@@ -67,8 +67,6 @@ CompoundForm::CompoundForm(QWidget* parent, CompoundItem* compoundItem, SampleEd ...@@ -67,8 +67,6 @@ CompoundForm::CompoundForm(QWidget* parent, CompoundItem* compoundItem, SampleEd
if (allowRemove) if (allowRemove)
addTitleAction(m_removeAction); addTitleAction(m_removeAction);
} }
m_layout = layouter.layout();
} }
CompoundForm::~CompoundForm() = default; CompoundForm::~CompoundForm() = default;
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
#define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_COMPOUNDFORM_H #define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_COMPOUNDFORM_H
#include "GUI/View/Widget/GroupBoxes.h" #include "GUI/View/Widget/GroupBoxes.h"
#include <QFormLayout>
class CompoundItem; class CompoundItem;
class HeinzFormLayout;
class ItemWithParticles; class ItemWithParticles;
class SampleEditorController; class SampleEditorController;
...@@ -36,7 +36,7 @@ public: ...@@ -36,7 +36,7 @@ public:
void onAboutToRemoveParticle(ItemWithParticles* item); void onAboutToRemoveParticle(ItemWithParticles* item);
private: private:
QFormLayout* m_layout; HeinzFormLayout* m_layout;
CompoundItem* m_compositionItem; CompoundItem* m_compositionItem;
QAction* m_removeAction = nullptr; QAction* m_removeAction = nullptr;
QAction* m_duplicateAction = nullptr; QAction* m_duplicateAction = nullptr;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment