BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
PropertyWidgetItem.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/PropertyEditor/PropertyWidgetItem.h
6 //! @brief Defines class PropertyWidgetItem
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_COREGUI_VIEWS_PROPERTYEDITOR_PROPERTYWIDGETITEM_H
16 #define BORNAGAIN_GUI_COREGUI_VIEWS_PROPERTYEDITOR_PROPERTYWIDGETITEM_H
17 
18 #include <QObject>
19 
20 class QLabel;
21 class QWiget;
22 class QDataWidgetMapper;
23 class QGridLayout;
24 class SessionItem;
26 
27 //! Container to hold label and editor for PropertyItem.
28 //! Contains also logic to map editor to SessionModel.
29 
30 class PropertyWidgetItem : public QObject {
31  Q_OBJECT
32 public:
33  explicit PropertyWidgetItem(QWidget* parent = nullptr);
35 
36  void setItemEditor(const SessionItem* item, QWidget* editor);
37  void addToGrid(QGridLayout* gridLayout, int nrow);
38 
39  void updateItemRoles();
40 
41  const SessionItem* item();
42 
43 private:
44  void connectEditor(QWidget* editor);
45 
46  QLabel* m_label;
47  QWidget* m_editor;
48  QDataWidgetMapper* m_dataMapper;
51 };
52 
53 #endif // BORNAGAIN_GUI_COREGUI_VIEWS_PROPERTYEDITOR_PROPERTYWIDGETITEM_H
Container to hold label and editor for PropertyItem.
const SessionItem * item()
void addToGrid(QGridLayout *gridLayout, int nrow)
SessionModelDelegate * m_delegate
const SessionItem * m_item
PropertyWidgetItem(QWidget *parent=nullptr)
QDataWidgetMapper * m_dataMapper
void connectEditor(QWidget *editor)
Provide additional connections of editor to model mapper.
void setItemEditor(const SessionItem *item, QWidget *editor)
The SessionModelDelegate class presents the content of SessionModel items in standard QTreeView.