BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
PropertyRepeater.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/PlotComparison/PropertyRepeater.h
6 //! @brief Defines class PropertyRepeater
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_VIEW_PLOTCOMPARISON_PROPERTYREPEATER_H
16 #define BORNAGAIN_GUI_VIEW_PLOTCOMPARISON_PROPERTYREPEATER_H
17 
18 #include <QMap>
19 #include <QObject>
20 #include <QVector>
21 
22 class SessionItem;
23 
24 //! Tracks property change (axes range, units etc) for the collection of IntensityDataItems
25 //! and sets same properties for all of them.
26 
27 class PropertyRepeater : public QObject {
28  Q_OBJECT
29 public:
30  explicit PropertyRepeater(QObject* parent = nullptr, bool repeat_child_properties = false);
31  ~PropertyRepeater() override;
32 
33  void addItem(SessionItem* sessionItem);
34 
35  void clear();
36 
37  void setActive(bool isActive);
38 
39 private:
40  void onPropertyChanged(SessionItem* item, const QString& propertyName);
41  void setOnChildPropertyChange(SessionItem* item, const QString& propertyName);
42  QVector<SessionItem*> targetItems(SessionItem* sourceItem);
43 
44  QVector<SessionItem*> m_dataItems;
47 };
48 
49 #endif // BORNAGAIN_GUI_VIEW_PLOTCOMPARISON_PROPERTYREPEATER_H
Tracks property change (axes range, units etc) for the collection of IntensityDataItems and sets same...
~PropertyRepeater() override
void setActive(bool isActive)
QVector< SessionItem * > m_dataItems
void setOnChildPropertyChange(SessionItem *item, const QString &propertyName)
QVector< SessionItem * > targetItems(SessionItem *sourceItem)
Returns list of target items to update their properties.
void onPropertyChanged(SessionItem *item, const QString &propertyName)
PropertyRepeater(QObject *parent=nullptr, bool repeat_child_properties=false)
void addItem(SessionItem *sessionItem)
Base class for a GUI data item.
Definition: SessionItem.h:204