BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
externalpropertycomboeditor.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/externalpropertycomboeditor.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_EXTERNALPROPERTYCOMBOEDITOR_H
16 #define BORNAGAIN_MVVM_VIEWMODEL_MVVM_EDITORS_EXTERNALPROPERTYCOMBOEDITOR_H
17 
19 #include <functional>
20 #include <vector>
21 
22 class QComboBox;
23 class QStandardItemModel;
24 
25 namespace ModelView {
26 
27 class ExternalProperty;
28 
29 //! Custom editor for table/tree cells to select ExternalProperty from the list of
30 //! external properties. Uses callbacks to retrieve vector of possible properties.
31 
32 class MVVM_VIEWMODEL_EXPORT ExternalPropertyComboEditor : public CustomEditor {
33  Q_OBJECT
34 
35 public:
36  using callback_t = std::function<std::vector<ModelView::ExternalProperty>()>;
37 
38  ExternalPropertyComboEditor(callback_t callback, QWidget* parent = nullptr);
39 
40  QSize sizeHint() const override;
41  QSize minimumSizeHint() const override;
42 
43 protected slots:
44  virtual void onIndexChanged(int index);
45 
46 private:
47  int internIndex();
48  void setConnected(bool isConnected);
49  void update_components() override;
50 
52  QComboBox* m_box{nullptr};
53  QStandardItemModel* m_comboModel{nullptr};
54 };
55 
56 } // namespace ModelView
57 
58 #endif // BORNAGAIN_MVVM_VIEWMODEL_MVVM_EDITORS_EXTERNALPROPERTYCOMBOEDITOR_H
The ExternalProperty class defines custom QVariant property to carry the text, color and an identifie...
Base class for all custom variant editors.
Definition: customeditor.h:26
Custom editor for table/tree cells to select ExternalProperty from the list of external properties.
std::function< std::vector< ModelView::ExternalProperty >()> callback_t
Defines class CLASS?
materialitems.h Collection of materials to populate MaterialModel.