BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
externalpropertyeditor.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/externalpropertyeditor.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_EXTERNALPROPERTYEDITOR_H
16 #define BORNAGAIN_MVVM_VIEWMODEL_MVVM_EDITORS_EXTERNALPROPERTYEDITOR_H
17 
19 #include <functional>
20 
21 class QLabel;
22 
23 namespace ModelView {
24 
25 class LostFocusFilter;
26 
27 //! Custom editor for QVariant based on ExternalProperty.
28 //! Contains icon, label and button to call external dialog via callback mechanism.
29 
30 class MVVM_VIEWMODEL_EXPORT ExternalPropertyEditor : public CustomEditor {
31  Q_OBJECT
32 
33 public:
34  explicit ExternalPropertyEditor(QWidget* parent = nullptr);
35 
36  void setCallback(std::function<void(const QVariant&)> callback);
37 
38 private slots:
39  void buttonClicked();
40 
41 private:
42  void update_components() override;
43  QLabel* m_textLabel;
44  QLabel* m_pixmapLabel;
46  std::function<void(const QVariant&)> m_callback; //! actions to take on clicked button
47 };
48 
49 } // namespace ModelView
50 
51 #endif // BORNAGAIN_MVVM_VIEWMODEL_MVVM_EDITORS_EXTERNALPROPERTYEDITOR_H
Event filter to prevent lost of focus by custom material editor.
Base class for all custom variant editors.
Definition: customeditor.h:26
Custom editor for QVariant based on ExternalProperty.
std::function< void(const QVariant &)> m_callback
Event filter to prevent loss of the focus.
Defines class CLASS?
materialitems.h Collection of materials to populate MaterialModel.