BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
IntensityDataPropertyWidget.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/PlotUtil/IntensityDataPropertyWidget.h
6 //! @brief Defines class IntensityDataPropertyWidget
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 
15 #ifndef BORNAGAIN_GUI_VIEW_PLOTUTIL_INTENSITYDATAPROPERTYWIDGET_H
16 #define BORNAGAIN_GUI_VIEW_PLOTUTIL_INTENSITYDATAPROPERTYWIDGET_H
17 
19 #include <QComboBox>
20 #include <QList>
21 #include <QString>
22 #include <functional>
23 
24 class IntensityDataItem;
25 class JobItem;
26 class QFormLayout;
27 class DoubleDescriptor;
28 
29 using std::function;
30 
31 //! Widget to edit properties of an IntensityDataItem.
32 
33 class IntensityDataPropertyWidget : public QWidget {
34  Q_OBJECT
35 public:
36  explicit IntensityDataPropertyWidget(QWidget* parent = nullptr);
38 
39  void setItem(IntensityDataItem* mainItem, IntensityDataItem* realItem = nullptr);
40  const JobItem* jobItem() const;
41 
42 private:
44  QWidget* createTextEdit(SessionItem* item);
45  QWidget* createCheckBox(const QString& title, SessionItem* item);
46  QWidget* createCheckBox(const QString& title, function<bool()> getter,
47  function<void(bool)> setter);
49 
50  void updateUIValues();
51 
52 private:
53  QWidget* parent;
55  QFormLayout* m_mainLayout;
56  QList<function<void()>> m_updaters;
57 };
58 
59 #endif // BORNAGAIN_GUI_VIEW_PLOTUTIL_INTENSITYDATAPROPERTYWIDGET_H
Defines class SelectionDescriptor.
Describes properties of a double value which are necessary to allow GUI representation,...
Widget to edit properties of an IntensityDataItem.
QWidget * createTextEdit(SessionItem *item)
void setItem(IntensityDataItem *mainItem, IntensityDataItem *realItem=nullptr)
QList< function< void()> > m_updaters
QWidget * createDoubleSpinbox(DoubleDescriptor d)
QWidget * createCheckBox(const QString &title, SessionItem *item)
IntensityDataPropertyWidget(QWidget *parent=nullptr)
QWidget * createComboBox(SelectionDescriptor< QString > d)
Describes a selection (various possibilities and the current one).
Base class for a GUI data item.
Definition: SessionItem.h:204