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 @@
#include "GUI/View/SampleDesigner/CompoundForm.h"
#include "GUI/Model/Sample/CompoundItem.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 <QAction>
#include <QPushButton>
......@@ -26,15 +26,15 @@ CompoundForm::CompoundForm(QWidget* parent, CompoundItem* compoundItem, SampleEd
, m_compositionItem(compoundItem)
, m_ec(ec)
{
FormLayouter layouter(this, ec);
layouter.setContentsMargins(30, 6, 0, 0);
layouter.addVector(compoundItem->position(), false);
layouter.addSelection(compoundItem->rotationSelection());
layouter.addValue(compoundItem->abundance());
body()->setLayout(layouter.layout());
m_layout = new HeinzFormLayout(this, ec);
body()->setLayout(m_layout);
m_layout->setContentsMargins(30, 6, 0, 0);
m_layout->addVector(compoundItem->position(), false);
m_layout->addSelection(compoundItem->rotationSelection());
m_layout->addValue(compoundItem->abundance());
for (auto* particle : compoundItem->itemsWithParticles())
layouter.addRow(
m_layout->addRow(
LayerEditorUtil::createWidgetForItemWithParticles(this, particle, false, ec));
auto* btn = LayerEditorUtil::createAddParticleButton(
......@@ -42,7 +42,7 @@ CompoundForm::CompoundForm(QWidget* parent, CompoundItem* compoundItem, SampleEd
[=](ItemWithParticlesCatalog::Type type) { ec->addCompoundItem(compoundItem, type); });
m_structureEditingWidgets << btn;
layouter.addStructureEditingRow(btn);
m_layout->addStructureEditingRow(btn);
// top right corner actions
// show in real space
......@@ -67,8 +67,6 @@ CompoundForm::CompoundForm(QWidget* parent, CompoundItem* compoundItem, SampleEd
if (allowRemove)
addTitleAction(m_removeAction);
}
m_layout = layouter.layout();
}
CompoundForm::~CompoundForm() = default;
......
......@@ -16,9 +16,9 @@
#define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_COMPOUNDFORM_H
#include "GUI/View/Widget/GroupBoxes.h"
#include <QFormLayout>
class CompoundItem;
class HeinzFormLayout;
class ItemWithParticles;
class SampleEditorController;
......@@ -36,7 +36,7 @@ public:
void onAboutToRemoveParticle(ItemWithParticles* item);
private:
QFormLayout* m_layout;
HeinzFormLayout* m_layout;
CompoundItem* m_compositionItem;
QAction* m_removeAction = 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