BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
SpecularDataPropertyWidget.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/PropertyEditor/SpecularDataPropertyWidget.h
6 //! @brief Defines class SpecularDataPropertyWidget
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2021
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_VIEW_PROPERTYEDITOR_SPECULARDATAPROPERTYWIDGET_H
16 #define BORNAGAIN_GUI_VIEW_PROPERTYEDITOR_SPECULARDATAPROPERTYWIDGET_H
17 
19 #include <QList>
20 #include <QString>
21 #include <QWidget>
22 #include <functional>
23 
24 class SpecularDataItem;
25 class SessionItem;
26 class QFormLayout;
27 class DoubleDescriptor;
28 class Data1DViewItem;
29 class JobItem;
30 
31 using std::function;
32 
33 //! Widget to edit properties of a SpecularDataItem or a Data1DViewItem.
34 
35 class SpecularDataPropertyWidget : public QWidget {
36  Q_OBJECT
37 public:
38  explicit SpecularDataPropertyWidget(QWidget* parent = nullptr);
39 
40  void setItem(SpecularDataItem* item);
41  void setItem(Data1DViewItem* item);
42  const JobItem* jobItem() const;
43 
44 private:
46  QWidget* createTextEdit(SessionItem* item);
47  QWidget* createCheckBox(const QString& title, SessionItem* item);
48  QWidget* createCheckBox(const QString& title, function<bool()> getter,
49  function<void(bool)> setter);
51 
52  void updateUIValues();
53  void setCurrentItem(SessionItem* item);
54 
55 private:
56  QWidget* m_parent;
58  QFormLayout* m_mainLayout;
59  QList<function<void()>> m_updaters;
60 };
61 
62 #endif // BORNAGAIN_GUI_VIEW_PROPERTYEDITOR_SPECULARDATAPROPERTYWIDGET_H
Defines class SelectionDescriptor.
View model for 1D DataItem. Can represent several items at once. In current implementation the first ...
Describes properties of a double value which are necessary to allow GUI representation,...
Describes a selection (various possibilities and the current one).
Base class for a GUI data item.
Definition: SessionItem.h:204
Widget to edit properties of a SpecularDataItem or a Data1DViewItem.
QWidget * createTextEdit(SessionItem *item)
SpecularDataPropertyWidget(QWidget *parent=nullptr)
QWidget * createComboBox(SelectionDescriptor< QString > d)
QWidget * createCheckBox(const QString &title, SessionItem *item)
void setItem(SpecularDataItem *item)
QWidget * createDoubleSpinbox(DoubleDescriptor d)
QList< function< void()> > m_updaters
void setCurrentItem(SessionItem *item)