BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
customeditor.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/viewmodel/mvvm/editors/customeditor.h
6 //! @brief Defines class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_MVVM_VIEWMODEL_MVVM_EDITORS_CUSTOMEDITOR_H
16 #define BORNAGAIN_MVVM_VIEWMODEL_MVVM_EDITORS_CUSTOMEDITOR_H
17 
18 #include "mvvm/core/variant.h"
19 #include "mvvm/viewmodel_export.h"
20 #include <QWidget>
21 
22 namespace ModelView {
23 
24 //! Base class for all custom variant editors.
25 
26 class MVVM_VIEWMODEL_EXPORT CustomEditor : public QWidget {
27  Q_OBJECT
28  Q_PROPERTY(QVariant value MEMBER m_data READ data WRITE setData NOTIFY dataChanged USER true)
29 
30 public:
31  explicit CustomEditor(QWidget* parent = nullptr);
32 
33  QVariant data() const;
34 
35  virtual bool is_persistent() const;
36 
37 public slots:
38  void setData(const QVariant& data);
39 
40 signals:
41  //! Emmits signal when data was changed in an editor.
42  void dataChanged(QVariant value);
43 
44 protected:
45  void setDataIntern(const QVariant& data);
46  //! Should update widget components from m_data, if necessary.
47  virtual void update_components() = 0;
48  QVariant m_data;
49 };
50 
51 } // namespace ModelView
52 
53 #endif // BORNAGAIN_MVVM_VIEWMODEL_MVVM_EDITORS_CUSTOMEDITOR_H
Base class for all custom variant editors.
Definition: customeditor.h:26
void dataChanged(QVariant value)
Emmits signal when data was changed in an editor.
virtual void update_components()=0
Should update widget components from m_data, if necessary.
materialitems.h Collection of materials to populate MaterialModel.
Defines class CLASS?