BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Form to present/edit a MultiLayer (sample)
Definition at line 28 of file MultiLayerForm.h.
Public Member Functions | |
MultiLayerForm (QWidget *parent, MultiLayerItem *sampleItem, SampleEditorController *ec) | |
void | ensureVisible (QWidget *w) |
LayerForm * | findNextLayerForm (QWidget *w) |
Search for the next LayerForm, starting from the given widget. More... | |
void | onAboutToRemoveLayer (LayerItem *layerItem) |
Call this before removing (deleting) a LayerItem. More... | |
void | onLayerAdded (LayerItem *layerItem) |
Create widgets for the new layer. More... | |
void | onLayerMoved (LayerItem *layerItem) |
Call this when a layerItem has been moved to a different position. More... | |
void | setUseAngstrom (bool angstrom) |
Show values in Angstrom or nanometers. More... | |
void | setUseRadiant (bool radiant) |
Show values in radiants or degrees. More... | |
void | showAddLayerButtons (bool show) |
Shows or hides the "Add Layer" buttons. More... | |
void | showInlineEditButtons (bool b) |
Show or hide all buttons related to structure editing (like "add layer", "remove particle") More... | |
void | updateRowVisibilities () |
void | updateUnits () |
Update the presented units in all contained widgets according to current settings. More... | |
bool | useAngstrom () const |
bool | useRadiant () const |
Private Attributes | |
QList< QPushButton * > | m_addLayerButtons |
SampleEditorController * | m_ec |
Ptr is borrowed, don't delete. More... | |
QVBoxLayout * | m_layout |
MultiLayerItem * | m_sampleItem |
Ptr is borrowed, don't delete. More... | |
bool | m_showInlineEditButtons = false |
bool | m_useAngstrom |
bool | m_useRadiant |
MultiLayerForm::MultiLayerForm | ( | QWidget * | parent, |
MultiLayerItem * | sampleItem, | ||
SampleEditorController * | ec | ||
) |
Definition at line 55 of file MultiLayerForm.cpp.
References FormLayouter::addRow(), FormLayouter::addValue(), FormLayouter::addVector(), ActionFactory::createShowInRealSpaceAction(), MultiLayerItem::crossCorrLength(), MultiLayerItem::description(), MultiLayerItem::externalFieldVector(), GroupBoxCollapser::installIntoGroupBox(), MultiLayerItem::layers(), m_ec, m_layout, m_sampleItem, SampleEditorController::requestViewInRealSpace(), MultiLayerItem::sampleName(), FormLayouter::setContentsMargins(), SampleEditorController::setSampleDescription(), and SampleEditorController::setSampleName().
void MultiLayerForm::ensureVisible | ( | QWidget * | w | ) |
Definition at line 248 of file MultiLayerForm.cpp.
Referenced by SampleEditorController::setDoubleFromUndo().
LayerForm * MultiLayerForm::findNextLayerForm | ( | QWidget * | w | ) |
Search for the next LayerForm, starting from the given widget.
The search starts with the given widget itself If it is a LayerForm, it is returned. If no following LayerForm is found, nullptr is returned.
Definition at line 282 of file MultiLayerForm.cpp.
References m_layout.
Referenced by SampleEditorController::onStoppedToMoveLayer().
void MultiLayerForm::onAboutToRemoveLayer | ( | LayerItem * | layerItem | ) |
Call this before removing (deleting) a LayerItem.
Any widgets related to the item will be deleted or scheduled for later deletion.
Definition at line 161 of file MultiLayerForm.cpp.
References GUI::Util::Layout::clearLayout().
Referenced by SampleEditorController::removeLayerFromUndo().
void MultiLayerForm::onLayerAdded | ( | LayerItem * | layerItem | ) |
Create widgets for the new layer.
Definition at line 114 of file MultiLayerForm.cpp.
References MultiLayerItem::layers(), m_ec, m_layout, m_sampleItem, and updateRowVisibilities().
Referenced by SampleEditorController::addLayerFromUndo(), and CommandRemoveLayer::undo().
void MultiLayerForm::onLayerMoved | ( | LayerItem * | layerItem | ) |
Call this when a layerItem has been moved to a different position.
This updates the item's position in the layout.
Definition at line 128 of file MultiLayerForm.cpp.
References MultiLayerItem::layers(), m_layout, m_sampleItem, and updateRowVisibilities().
Referenced by SampleEditorController::onStoppedToMoveLayer().
void MultiLayerForm::setUseAngstrom | ( | bool | angstrom | ) |
Show values in Angstrom or nanometers.
Definition at line 253 of file MultiLayerForm.cpp.
References angstrom, m_useAngstrom, and updateUnits().
Referenced by LayerOrientedSampleEditor::onUnitActionToggled(), and LayerOrientedSampleEditor::setCurrentSample().
void MultiLayerForm::setUseRadiant | ( | bool | radiant | ) |
Show values in radiants or degrees.
Definition at line 264 of file MultiLayerForm.cpp.
References m_useRadiant, radiant, and updateUnits().
void MultiLayerForm::showAddLayerButtons | ( | bool | show | ) |
Shows or hides the "Add Layer" buttons.
Definition at line 275 of file MultiLayerForm.cpp.
Referenced by SampleEditorController::onStartingToMoveLayer(), SampleEditorController::onStoppedToMoveLayer(), and updateRowVisibilities().
void MultiLayerForm::showInlineEditButtons | ( | bool | b | ) |
Show or hide all buttons related to structure editing (like "add layer", "remove particle")
Definition at line 108 of file MultiLayerForm.cpp.
References m_showInlineEditButtons, and updateRowVisibilities().
Referenced by LayerOrientedSampleEditor::onShowInlineEditButtonsToggled(), and LayerOrientedSampleEditor::setCurrentSample().
void MultiLayerForm::updateRowVisibilities | ( | ) |
Definition at line 188 of file MultiLayerForm.cpp.
References m_showInlineEditButtons, and showAddLayerButtons().
Referenced by onLayerAdded(), onLayerMoved(), SampleEditorController::removeLayerFromUndo(), and showInlineEditButtons().
void MultiLayerForm::updateUnits | ( | ) |
Update the presented units in all contained widgets according to current settings.
Definition at line 212 of file MultiLayerForm.cpp.
References angstrom, angstrom2, angstromMinus2, DoubleSpinBox::baseUnit(), degree, m_useAngstrom, m_useRadiant, nanometer, nanometer2, nanometerMinus2, radiant, DoubleSpinBox::setDisplayUnit(), and LayerEditorUtils::updateLabelUnit().
Referenced by SampleEditorController::addLayerFromUndo(), SampleEditorController::addLayout(), SampleEditorController::addParticle(), SampleEditorController::selectInterference(), SampleEditorController::setCoreFormFactor(), SampleEditorController::setCurrentIndex(), SampleEditorController::setMesoCrystalBasis(), SampleEditorController::setShellFormFactor(), setUseAngstrom(), and setUseRadiant().
bool MultiLayerForm::useAngstrom | ( | ) | const |
Definition at line 259 of file MultiLayerForm.cpp.
References m_useAngstrom.
bool MultiLayerForm::useRadiant | ( | ) | const |
Definition at line 270 of file MultiLayerForm.cpp.
References m_useRadiant.
|
private |
Definition at line 80 of file MultiLayerForm.h.
|
private |
Ptr is borrowed, don't delete.
Definition at line 76 of file MultiLayerForm.h.
Referenced by MultiLayerForm(), and onLayerAdded().
|
private |
Definition at line 74 of file MultiLayerForm.h.
Referenced by MultiLayerForm(), findNextLayerForm(), onLayerAdded(), and onLayerMoved().
|
private |
Ptr is borrowed, don't delete.
Definition at line 75 of file MultiLayerForm.h.
Referenced by MultiLayerForm(), onLayerAdded(), and onLayerMoved().
|
private |
Definition at line 77 of file MultiLayerForm.h.
Referenced by showInlineEditButtons(), and updateRowVisibilities().
|
private |
Definition at line 78 of file MultiLayerForm.h.
Referenced by setUseAngstrom(), updateUnits(), and useAngstrom().
|
private |
Definition at line 79 of file MultiLayerForm.h.
Referenced by setUseRadiant(), updateUnits(), and useRadiant().