BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
RealDataMaskWidget.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Import/RealDataMaskWidget.cpp
6 //! @brief Implements class RealDataMaskWidget
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
20 #include <QAction>
21 #include <QBoxLayout>
22 
24  : SessionItemWidget(parent)
25  , m_maskEditor(new MaskEditor)
26 {
27  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
28 
29  auto* hlayout = new QHBoxLayout;
30  hlayout->setMargin(0);
31  hlayout->setSpacing(0);
32 
33  hlayout->addWidget(m_maskEditor);
34 
35  auto* mainLayout = new QVBoxLayout;
36  mainLayout->setMargin(0);
37  mainLayout->setSpacing(0);
38 
39  mainLayout->addLayout(hlayout);
40  setLayout(mainLayout);
41 }
42 
44 {
46 }
47 
49 {
50  auto* intensityItem = intensityDataItem();
51  auto* container = maskContainer(intensityItem);
52  m_maskEditor->setMaskContext(intensityItem->model(), container->index(), intensityItem);
53  m_maskEditor->update();
54 }
55 
57 {
59 }
60 
62 {
63  IntensityDataItem* result = dynamic_cast<RealDataItem*>(currentItem())->intensityDataItem();
64  ASSERT(result);
65  return result;
66 }
67 
69 {
70  MaskContainerItem* containerItem = intensityData->getOrCreateMaskContainerItem();
71  ASSERT(containerItem);
72  return containerItem;
73 }
Defines class IntensityDataItem.
Defines class MaskEditor.
Defines MaskItems classes.
Defines class RealDataItem.
Defines class RealDataMaskWidget.
MaskContainerItem * getOrCreateMaskContainerItem()
Container holding various masks as children.
Definition: MaskItems.h:202
Main class to draw masks on top of intensity data map.
Definition: MaskEditor.h:31
void resetContext()
Definition: MaskEditor.cpp:67
QList< QAction * > topToolbarActions()
Returns list of actions intended for styled toolbar (on the top).
Definition: MaskEditor.cpp:87
void setMaskContext(SessionModel *model, const QModelIndex &maskContainerIndex, IntensityDataItem *intensityItem)
Main method to setup context for mask editing.
Definition: MaskEditor.cpp:51
Provides access to experimental data, for display and fitting. Owns an AbstractDataLoader.
Definition: RealDataItem.h:33
void subscribeToItem() override
void unsubscribeFromItem() override
QList< QAction * > actionList() override
MaskContainerItem * maskContainer(IntensityDataItem *intensityData)
RealDataMaskWidget(QWidget *parent=nullptr)
MaskEditor * m_maskEditor
IntensityDataItem * intensityDataItem()
The SessionItemWidget class is a base for all widgets representing the content of SessionItem....
SessionItem * currentItem()