BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
IntensityDataFFTPresenter.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Plot2D/IntensityDataFFTPresenter.cpp
6 //! @brief Defines class IntensityDataFFTPresenter
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 
16 #include "Device/Data/DataUtils.h"
19 #include "GUI/Util/Error.h"
20 #include <QAction>
21 #include <QApplication>
22 #include <QWidget>
23 
25  : QObject(parent)
26  , m_fftAction(nullptr)
27  , m_fftModel(new SessionModel("TempFFTModel", this))
28  , m_fftItem(nullptr)
29  , m_in_fft_mode(false)
30 {
32  m_fftAction = new QAction(this);
33  m_fftAction->setText("Fourier");
34  m_fftAction->setIcon(QIcon(":/images/alpha-f-box.svg"));
35  m_fftAction->setToolTip("Get the Fourier Transform of current intensity map");
36  m_fftAction->setCheckable(true);
37  connect(m_fftAction, &QAction::toggled, this, &IntensityDataFFTPresenter::onFFTActionToggled);
38 }
39 
41 {
42  m_in_fft_mode = false;
43 }
44 
46 {
47  if (!origItem)
48  throw Error("IntensityDataFFTPresenter::fftItem() -> Error. Empty item.");
49 
50  QApplication::setOverrideCursor(Qt::WaitCursor);
51 
52  m_fftItem->setDatafield(DataUtils::Data::createFFT(*origItem->getDatafield()).release());
53 
54  QApplication::restoreOverrideCursor();
55 
56  return m_fftItem;
57 }
58 
60 {
61  return QList<QAction*>() << m_fftAction;
62 }
63 
65 {
66  return m_in_fft_mode;
67 }
68 
70 {
71  m_in_fft_mode = toggled;
73 }
Defines error class.
Defines class IntensityDataFFTPresenter.
Defines class IntensityDataItem.
Defines class SessionModel.
Datafield * getDatafield()
Definition: DataItem.h:41
IntensityDataItem * fftItem(IntensityDataItem *origItem)
IntensityDataFFTPresenter(QWidget *parent=nullptr)
void setDatafield(Datafield *data) override
The given pointer becomes owned by this class!!
Base class for a GUI data collection. A collection is e.g. all real data (RealDataModel)....
Definition: SessionModel.h:42
T * insertItem(SessionItem *parent=nullptr, int row=-1, QString tag="")
Definition: SessionModel.h:137