BornAgain  1.19.79
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/View/Plot2D/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 
18 #include "GUI/Model/Job/JobItem.h"
19 #include "GUI/Util/ActionFactory.h"
24 #include <QBoxLayout>
25 #include <QMenu>
26 
28  : SessionItemWidget(parent)
29  , m_intensityCanvas(new IntensityDataCanvas)
30  , m_propertyWidget(new IntensityDataPropertyWidget(this))
31  , m_fftPresenter(new IntensityDataFFTPresenter(this))
32 {
33  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
34 
35  m_propertyWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
36 
37  auto* hlayout = new QHBoxLayout(this);
38  hlayout->setMargin(0);
39  hlayout->setSpacing(0);
40  hlayout->addWidget(m_intensityCanvas);
41  hlayout->addWidget(m_propertyWidget);
42 
43  connect(m_intensityCanvas, &IntensityDataCanvas::customContextMenuRequested, this,
45 
48 
51 
52 
53  m_propertyWidget->setVisible(false);
54 }
55 
57 {
62 }
63 
65 {
67  + QList<QAction*>{m_togglePropertiesAction};
68 }
69 
71 {
72  QMenu menu;
73  for (auto* action : actionList())
74  menu.addAction(action);
75  menu.exec(point);
76 }
77 
79 {
80  if (!intensityDataItem() || !intensityDataItem()->getDatafield())
81  return;
82 
83  if (m_fftPresenter->inFFTMode()) {
84  auto* fftItem = m_fftPresenter->fftItem(intensityDataItem());
85  m_intensityCanvas->setItem(fftItem);
86  m_propertyWidget->setItem(fftItem);
87  } else {
88  // returning ColorMap to non-fft presentation
91  }
92 }
93 
95 {
97 }
Defines class ActionFactory.
Defines functions in namespace GUI::Model::DataItemUtils.
Defines class IntensityDataCanvas.
Defines class IntensityDataFFTPresenter.
Defines class IntensityDataItem.
Defines class IntensityDataPropertyWidget.
Defines class IntensityDataWidget.
Defines class JobItem.
Defines class RealDataItem.
static QAction * createTogglePropertiesPanelAction(QObject *parent, QWidget *toggledWidget=nullptr)
Create "toggle properties panel" action.
The IntensityDataCanvas class represents IntensityDataItem as color map, provides standard actions (r...
QList< QAction * > actionList() override
void setItem(SessionItem *intensityItem) override
Provides support in Fast Fourier transformation of IntensityDataItem. Contains own model to hold Inte...
IntensityDataItem * fftItem(IntensityDataItem *origItem)
Widget to edit properties of an IntensityDataItem.
void setItem(IntensityDataItem *mainItem, IntensityDataItem *realItem=nullptr)
QList< QAction * > actionList() override
IntensityDataCanvas * m_intensityCanvas
IntensityDataPropertyWidget * m_propertyWidget
void onContextMenuRequest(const QPoint &point)
IntensityDataWidget(QWidget *parent=nullptr)
void setItem(SessionItem *jobItem) override
QAction * m_togglePropertiesAction
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)
Base class for a GUI data item.
Definition: SessionItem.h:204
IntensityDataItem * intensityDataItem(SessionItem *parent)
Returns IntensityDataItem contained as a child in givent parent.