BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
GroupItem.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/BaseItem/GroupItem.h
6 //! @brief Defines class GroupItem
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_MODEL_BASEITEM_GROUPITEM_H
16 #define BORNAGAIN_GUI_MODEL_BASEITEM_GROUPITEM_H
17 
20 #include <memory>
21 
22 class GroupInfo;
24 
25 class BA_CORE_API_ GroupItem : public SessionItem {
26 private:
27  static constexpr auto T_ITEMS{"Item tag"};
28 
29 public:
30  static constexpr auto M_TYPE{"GroupProperty"};
31 
32  GroupItem();
33  ~GroupItem() override;
34 
35  void setGroupInfo(const GroupInfo& groupInfo);
36  SessionItem* currentItem() const;
37 
38  QString currentType() const;
39 
40  SessionItem* setCurrentType(const QString& modelType);
41 
42  SessionItem* getItemOfType(const QString& type) const;
43 
44  template <typename T>
45  T* itemOfType() const;
46 
47  QVector<SessionItem*> groupItems() const;
48  static bool isItemsTagName(const QString& name);
49 
50 private:
51  void onValueChange();
52  void updateComboValue();
53  std::unique_ptr<GroupItemController> m_controller;
54 };
55 
56 template <typename T>
58 {
59  return dynamic_cast<T*>(m_controller->getItemOfType(T::M_TYPE));
60 }
61 
62 #endif // BORNAGAIN_GUI_MODEL_BASEITEM_GROUPITEM_H
Defines class GroupItemController.
Defines class SessionItem.
Defines info for GroupProperty, i.e. collection of model types, their labels and the name of default ...
Definition: GroupInfo.h:25
Provides logic for manipulating items belonging to GroupItem parent.
~GroupItem() override
std::unique_ptr< GroupItemController > m_controller
Definition: GroupItem.h:53
T * itemOfType() const
Definition: GroupItem.h:57
Base class for a GUI data item.
Definition: SessionItem.h:204
QString const & name(EShape k)
Definition: particles.cpp:20