BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ComponentProxyStrategy.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Models/ComponentProxyStrategy.h
6 //! @brief Defines class ComponentProxyStrategy
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_MODELS_COMPONENTPROXYSTRATEGY_H
16 #define BORNAGAIN_GUI_COREGUI_MODELS_COMPONENTPROXYSTRATEGY_H
17 
19 
20 //! Strategy for ComponentProxyModel which hides extra level of GroupProperty.
21 
23 public:
24  void onDataChanged(SessionModel* source, ComponentProxyModel* proxy);
25 
26 protected:
27  bool processSourceIndex(const QModelIndex& index);
28 
29 private:
30  bool isPropertyRelated(SessionItem* item);
31  bool isNewRootItem(SessionItem* item);
32  void processRootItem(SessionItem* item, const QPersistentModelIndex& sourceIndex);
33  bool isSubGroup(SessionItem* item);
34  bool isGroupChildren(SessionItem* item);
35  void processGroupItem(SessionItem* item, const QPersistentModelIndex& sourceIndex);
36  void processSubGroupItem(SessionItem* item, const QPersistentModelIndex& sourceIndex);
37  void processDefaultItem(SessionItem* item, const QPersistentModelIndex& sourceIndex);
38 
39  int parentVisibleRow(const SessionItem& item);
40 };
41 
42 #endif // BORNAGAIN_GUI_COREGUI_MODELS_COMPONENTPROXYSTRATEGY_H
Defines class ProxyModelStrategy.
Proxy model to adjust SessionModel for component editor (right bottom corner of SampleView and simila...
Strategy for ComponentProxyModel which hides extra level of GroupProperty.
void onDataChanged(SessionModel *source, ComponentProxyModel *proxy)
bool isNewRootItem(SessionItem *item)
Returns true if item should become new root item.
bool isPropertyRelated(SessionItem *item)
Returns true if item is property related to exclude top level items (ParticleLayout,...
void processSubGroupItem(SessionItem *item, const QPersistentModelIndex &sourceIndex)
Process group property which is inside of other group property.
bool processSourceIndex(const QModelIndex &index)
Mapping of proxy model indices to indices in source model.
bool isSubGroup(SessionItem *item)
Returns true if item is a group property which in turn is inside of another group property.
int parentVisibleRow(const SessionItem &item)
void processRootItem(SessionItem *item, const QPersistentModelIndex &sourceIndex)
Makes SessionItem to become the only one item in a tree.
void processGroupItem(SessionItem *item, const QPersistentModelIndex &sourceIndex)
All properties of current item of group item.
void processDefaultItem(SessionItem *item, const QPersistentModelIndex &sourceIndex)
bool isGroupChildren(SessionItem *item)
Returns true if item is a children/grandchildrent of some group item.
Base class for proxy strategies in ComponentProxyModel.