BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ParticleForm Class Reference

Description

Form for editing a particle.

Definition at line 25 of file ParticleForm.h.

Inheritance diagram for ParticleForm:
[legend]
Collaboration diagram for ParticleForm:
[legend]

Public Member Functions

 ParticleForm (QWidget *parent, ParticleItem *item, bool allowAbundance, SampleEditorController *ec, bool allowRemove=true)
 
void enableStructureEditing (bool b)
 

Private Attributes

QAction * m_removeAction = nullptr
 

Constructor & Destructor Documentation

◆ ParticleForm()

ParticleForm::ParticleForm ( QWidget *  parent,
ParticleItem item,
bool  allowAbundance,
SampleEditorController ec,
bool  allowRemove = true 
)

Definition at line 26 of file ParticleForm.cpp.

28  : QGroupBox(parent)
29 {
30  const QString formfactor =
31  FormFactorItemCatalog::menuEntry(particleItem->formfactor_at_bottom());
32  setTitle("Particle (" + formfactor + ")");
33 
34  FormLayouter layouter(this, ec);
35  layouter.addRow("Material", new MaterialInplaceForm(this, particleItem, ec));
36  layouter.addGroupOfValues("Geometry", particleItem->formfactor_at_bottom()->geometryValues());
37  layouter.addVector(particleItem->positionVector(), false);
38  layouter.addSelection(particleItem->rotation());
39  if (allowAbundance)
40  layouter.addValue(particleItem->abundance());
41 
42  auto* collapser = GroupBoxCollapser::installIntoGroupBox(this);
43 
44  auto* showInRealSpaceAction = ActionFactory::createShowInRealSpaceAction(
45  this, "particle", [=] { ec->requestViewInRealSpace(particleItem); });
46  collapser->addAction(showInRealSpaceAction);
47 
48  if (allowRemove) {
50  this, "particle", [=] { ec->removeParticle(particleItem); });
51  collapser->addAction(m_removeAction);
52  }
53 }
static QAction * createShowInRealSpaceAction(QObject *parent, const QString &what, std::function< void()> slot=nullptr)
Create "show in RealSpace" action.
static QAction * createRemoveAction(QObject *parent, const QString &what, std::function< void()> slot=nullptr)
Create "remove" action.
static QString menuEntry(const FormFactorItem *item)
Utility class to populate a QFormLayout.
Definition: FormLayouter.h:36
static GroupBoxCollapser * installIntoGroupBox(QGroupBox *groupBox, bool expanded=true)
Form to select a material and to edit it in-place.
QAction * m_removeAction
Definition: ParticleForm.h:33
void requestViewInRealSpace(SampleItem item)
void removeParticle(ItemWithParticles *item)

References ItemWithParticles::abundance(), FormLayouter::addGroupOfValues(), FormLayouter::addRow(), FormLayouter::addSelection(), FormLayouter::addValue(), FormLayouter::addVector(), ActionFactory::createRemoveAction(), ActionFactory::createShowInRealSpaceAction(), ParticleItem::formfactor_at_bottom(), FormFactorItem::geometryValues(), GroupBoxCollapser::installIntoGroupBox(), m_removeAction, FormFactorItemCatalog::menuEntry(), ItemWithParticles::positionVector(), SampleEditorController::removeParticle(), SampleEditorController::requestViewInRealSpace(), and ItemWithParticles::rotation().

Here is the call graph for this function:

Member Function Documentation

◆ enableStructureEditing()

void ParticleForm::enableStructureEditing ( bool  b)

Definition at line 55 of file ParticleForm.cpp.

56 {
57  if (m_removeAction)
58  m_removeAction->setVisible(b);
59 }

References m_removeAction.

Member Data Documentation

◆ m_removeAction

QAction* ParticleForm::m_removeAction = nullptr
private

Definition at line 33 of file ParticleForm.h.

Referenced by ParticleForm(), and enableStructureEditing().


The documentation for this class was generated from the following files: