BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
InstrumentModel.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Models/InstrumentModel.h
6 //! @brief Defines class InstrumentModel
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_INSTRUMENTMODEL_H
16 #define BORNAGAIN_GUI_COREGUI_MODELS_INSTRUMENTMODEL_H
17 
19 
20 class InstrumentItem;
21 
22 class InstrumentModel : public SessionModel {
23  Q_OBJECT
24 
25 public:
26  explicit InstrumentModel(QObject* parent = nullptr);
27  ~InstrumentModel() override;
28 
29  InstrumentModel* createCopy(SessionItem* parent = nullptr) override;
30  QVector<SessionItem*> nonXMLItems() const override;
31  virtual void readFrom(QXmlStreamReader* reader, MessageService* messageService = 0) override;
32 
33  QVector<InstrumentItem*> instrumentItems() const;
34 
35  InstrumentItem* findInstrumentById(const QString& instrumentId) const;
36  bool instrumentExists(const QString& instrumentId) const;
37 
38 signals:
40  void instrumentNameChanged(const InstrumentItem* instrument);
41 
42 private:
43  void onRowsChange(const QModelIndex& parent, int, int);
44  void onInstrumentPropertyChange(const InstrumentItem* instrument, const QString& propertyName);
45 };
46 
47 #endif // BORNAGAIN_GUI_COREGUI_MODELS_INSTRUMENTMODEL_H
Defines class SessionModel.
InstrumentModel * createCopy(SessionItem *parent=nullptr) override
void instrumentNameChanged(const InstrumentItem *instrument)
bool instrumentExists(const QString &instrumentId) const
InstrumentItem * findInstrumentById(const QString &instrumentId) const
QVector< SessionItem * > nonXMLItems() const override
InstrumentModel(QObject *parent=nullptr)
void onRowsChange(const QModelIndex &parent, int, int)
virtual void readFrom(QXmlStreamReader *reader, MessageService *messageService=0) override
void onInstrumentPropertyChange(const InstrumentItem *instrument, const QString &propertyName)
~InstrumentModel() override
QVector< InstrumentItem * > instrumentItems() const
void instrumentAddedOrRemoved()
The service to collect messages from different senders.
virtual QModelIndex parent(const QModelIndex &child) const