BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IntensityDataProjectionsWidget.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/IntensityDataWidgets/IntensityDataProjectionsWidget.cpp
6 //! @brief Defines class IntensityDataProjectionsWidget
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 
22 #include <QVBoxLayout>
23 
25  : SessionItemWidget(parent), m_projectionsEditor(new ProjectionsEditor)
26 {
27  QVBoxLayout* vlayout = new QVBoxLayout(this);
28  vlayout->setMargin(0);
29  vlayout->setSpacing(0);
30  vlayout->addWidget(m_projectionsEditor);
31 
32  setLayout(vlayout);
33 }
34 
36 {
38 }
39 
41 {
42  auto container = projectionContainer(intensityDataItem());
43 
44  m_projectionsEditor->setContext(intensityDataItem()->model(), container->index(),
46 }
47 
49 {
51 }
52 
54 {
56 }
57 
60 {
61  ASSERT(intensityItem);
62 
63  auto containerItem = intensityItem->getItem(IntensityDataItem::T_PROJECTIONS);
64  if (!containerItem)
65  containerItem = intensityItem->model()->insertNewItem("ProjectionContainer", intensityItem,
67 
68  return dynamic_cast<ProjectionContainerItem*>(containerItem);
69 }
#define ASSERT(condition)
Definition: Assert.h:31
Defines namespace DataItemUtils.
Defines class IntensityDataItem.
Defines class IntensityDataProjectionsWidget.
Defines class JobItem.
Defines items related to projections over color map.
Defines class ProjectionsEditor.
Defines class SessionModel.
static const QString T_PROJECTIONS
ProjectionContainerItem * projectionContainer(IntensityDataItem *intensityItem)
A container to hold ProjectionItems, intended to store projections of color map on X,...
Editor to draw projections on top of intensity plot. Part of.
QList< QAction * > topToolBarActions()
void setContext(SessionModel *model, const QModelIndex &shapeContainerIndex, IntensityDataItem *intensityItem)
The SessionItemWidget class is a base for all widgets representing the content of SessionItem.
SessionItem * currentItem()
SessionModel * model() const
Returns model of this item.
Definition: SessionItem.cpp:66
QModelIndex index() const
Returns model index of this item.
Definition: SessionItem.cpp:80
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.
SessionItem * insertNewItem(QString model_type, SessionItem *parent_item=nullptr, int row=-1, QString tag="")
IntensityDataItem * intensityDataItem(SessionItem *parent)
Returns IntensityDataItem contained as a child in givent parent.