BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
LinkInstrumentManager.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/ImportDataWidgets/LinkInstrumentManager.h
6 //! @brief Defines class LinkInstrumentManager
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 // #migration move this file to better folder
16 
17 #ifndef BORNAGAIN_GUI_COREGUI_VIEWS_IMPORTDATAWIDGETS_LINKINSTRUMENTMANAGER_H
18 #define BORNAGAIN_GUI_COREGUI_VIEWS_IMPORTDATAWIDGETS_LINKINSTRUMENTMANAGER_H
19 
20 #include <QList>
21 #include <QObject>
22 #include <QStringList>
23 #include <QVector>
24 
25 class InstrumentModel;
26 class RealDataModel;
27 class SessionItem;
28 class InstrumentItem;
29 class RealDataItem;
30 
31 //! The LinkInstrumentManager class provides communication between InstrumentModel and
32 //! RealDataModel. Particularly, it notifies RealDataItem about changes in linked instruments
33 //! to adjust axes of IntensityDataItem.
34 
35 class LinkInstrumentManager : public QObject {
36  Q_OBJECT
37 
38 public:
39  explicit LinkInstrumentManager(QObject* parent = nullptr);
40 
41  void setModels(InstrumentModel* instrumentModel, RealDataModel* realDataModel);
42 
43  //! quiet defines whether a "not possible" message box is shown if link is not possible. Use
44  //! this e.g. for unit tests. The question for adjusting the instrument is not suppressed by
45  //! this flag.
46  bool canLinkDataToInstrument(const RealDataItem* realDataItem, const QString& identifier,
47  bool quiet = false);
48 
49  QList<RealDataItem*> linkedRealDataItems(InstrumentItem* instrumentItem);
50 
51 private slots:
52  void onInstrumentChildChange(InstrumentItem* instrument, SessionItem* child);
54 
56 
57 private:
60 };
61 
62 #endif // BORNAGAIN_GUI_COREGUI_VIEWS_IMPORTDATAWIDGETS_LINKINSTRUMENTMANAGER_H
The LinkInstrumentManager class provides communication between InstrumentModel and RealDataModel.
void onInstrumentAddedOrRemoved()
Updates map of instruments on insert/remove InstrumentItem event.
bool canLinkDataToInstrument(const RealDataItem *realDataItem, const QString &identifier, bool quiet=false)
quiet defines whether a "not possible" message box is shown if link is not possible.
LinkInstrumentManager(QObject *parent=nullptr)
QList< RealDataItem * > linkedRealDataItems(InstrumentItem *instrumentItem)
Returns list of RealDataItem's linked to given instrument.
void setModels(InstrumentModel *instrumentModel, RealDataModel *realDataModel)
Sets models and builds initial links.
void onInstrumentChildChange(InstrumentItem *instrument, SessionItem *child)
Perform actions on instrument children change.
void updateInstrumentSubscriptions()
Set up callbacks to all instrument items.
InstrumentModel * m_instrumentModel
RealDataModel * m_realDataModel
The RealDataItem class represents intensity data imported from file and intended for fitting.
Definition: RealDataItem.h:35
The RealDataModel class is a model to store all imported RealDataItem's.
Definition: RealDataModel.h:26