BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IntensityDataWidget.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/IntensityDataWidget.cpp
6 //! @brief Implements class IntensityDataWidget
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 <QBoxLayout>
23 #include <QMenu>
24 
26  : SessionItemWidget(parent)
27  , m_intensityCanvas(new IntensityDataCanvas)
28  , m_propertyWidget(new IntensityDataPropertyWidget)
29  , m_fftPresenter(new IntensityDataFFTPresenter(this))
30 {
31  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
32 
33  auto hlayout = new QHBoxLayout;
34  hlayout->setMargin(0);
35  hlayout->setSpacing(0);
36  hlayout->addWidget(m_intensityCanvas);
37  hlayout->addWidget(m_propertyWidget);
38 
39  auto mainLayout = new QVBoxLayout;
40  mainLayout->setMargin(0);
41  mainLayout->setSpacing(0);
42  mainLayout->addLayout(hlayout);
43 
44  setLayout(mainLayout);
45 
46  connect(m_intensityCanvas, &IntensityDataCanvas::customContextMenuRequested, this,
48 
51 
52  m_propertyWidget->setVisible(false);
53 }
54 
56 {
61 }
62 
64 {
67 }
68 
70 {
71  QMenu menu;
72  for (auto action : actionList())
73  menu.addAction(action);
74  menu.exec(point);
75 }
76 
78 {
79  if (!intensityDataItem() || !intensityDataItem()->getOutputData())
80  return;
81 
82  if (m_fftPresenter->inFFTMode()) {
83  auto fftItem = m_fftPresenter->fftItem(intensityDataItem());
84  m_intensityCanvas->setItem(fftItem);
85  m_propertyWidget->setItem(fftItem);
86  } else {
87  // returning ColorMap to non-fft presentation
90  }
91 }
92 
94 {
96 }
Defines namespace DataItemUtils.
Defines class IntensityDataCanvas.
Defines class IntensityDataFFTPresenter.
Defines class IntensityDataItem.
Defines class IntensityDataPropertyWidget.
Defines class IntensityDataWidget.
Defines class JobItem.
The IntensityDataCanvas class represents IntensityDataItem as color map, provides standard actions (r...
void setItem(SessionItem *intensityItem)
QList< QAction * > actionList()
Provides support in Fast Fourier transformation of IntensityDataItem.
IntensityDataItem * fftItem(IntensityDataItem *origItem)
The IntensityDataPropertyWidget shows ComponentEditor for given IntensityDataItem.
IntensityDataCanvas * m_intensityCanvas
IntensityDataPropertyWidget * m_propertyWidget
void setItem(SessionItem *jobItem)
void onContextMenuRequest(const QPoint &point)
IntensityDataWidget(QWidget *parent=0)
QList< QAction * > actionList()
IntensityDataFFTPresenter * m_fftPresenter
IntensityDataItem * intensityDataItem()
The SessionItemWidget class is a base for all widgets representing the content of SessionItem.
SessionItem * currentItem()
virtual void setItem(SessionItem *item)
IntensityDataItem * intensityDataItem(SessionItem *parent)
Returns IntensityDataItem contained as a child in givent parent.