BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ApplicationModels Class Reference

Description

Definition at line 28 of file ApplicationModels.h.

Inheritance diagram for ApplicationModels:
[legend]
Collaboration diagram for ApplicationModels:
[legend]

Signals

void modelChanged ()
 

Public Member Functions

 ApplicationModels ()
 
JobModeljobModel () const
 
QVector< SessionItem * > nonXMLItems () const
 Returns all non-XML items. More...
 
void readFrom (class QXmlStreamReader *reader, MessageService *messageService)
 
RealDataModelrealDataModel () const
 
void writeTo (class QXmlStreamWriter *writer)
 Writes all model in file one by one. More...
 

Private Member Functions

void connectModel (SessionModel *model) const
 

Private Attributes

JobModelm_jobModel
 
RealDataModelm_realDataModel
 

Constructor & Destructor Documentation

◆ ApplicationModels()

ApplicationModels::ApplicationModels ( )

Definition at line 22 of file ApplicationModels.cpp.

23  : m_realDataModel(nullptr)
24  , m_jobModel(nullptr)
25 {
26  //! creates and initializes models, order is important
27  m_realDataModel = new RealDataModel(this);
28  m_jobModel = new JobModel(this);
29 
32 }
RealDataModel * m_realDataModel
void connectModel(SessionModel *model) const
The RealDataModel class is a model to store all imported RealDataItem's.
Definition: RealDataModel.h:24

References connectModel(), m_jobModel, and m_realDataModel.

Here is the call graph for this function:

Member Function Documentation

◆ connectModel()

void ApplicationModels::connectModel ( SessionModel model) const
private

Definition at line 73 of file ApplicationModels.cpp.

74 {
75  if (!model)
76  return;
77  connect(model, &SessionModel::dataChanged, this, &ApplicationModels::modelChanged,
78  Qt::UniqueConnection);
79  connect(model, &SessionModel::rowsRemoved, this, &ApplicationModels::modelChanged,
80  Qt::UniqueConnection);
81  connect(model, &SessionModel::rowsInserted, this, &ApplicationModels::modelChanged,
82  Qt::UniqueConnection);
83 }

References modelChanged().

Referenced by ApplicationModels().

◆ jobModel()

JobModel * ApplicationModels::jobModel ( ) const

Definition at line 39 of file ApplicationModels.cpp.

40 {
41  return m_jobModel;
42 }

References m_jobModel.

Referenced by ProjectDocument::jobModel().

◆ modelChanged

void ApplicationModels::modelChanged ( )
signal

◆ nonXMLItems()

QVector< SessionItem * > ApplicationModels::nonXMLItems ( ) const

Returns all non-XML items.

Definition at line 67 of file ApplicationModels.cpp.

68 {
69  ASSERT(m_realDataModel && m_jobModel);
70  return QVector<SessionItem*>() << m_realDataModel->nonXMLItems() << m_jobModel->nonXMLItems();
71 }
QVector< SessionItem * > nonXMLItems() const override
Definition: JobModel.cpp:108
QVector< SessionItem * > nonXMLItems() const override

References m_jobModel, m_realDataModel, JobModel::nonXMLItems(), and RealDataModel::nonXMLItems().

Referenced by DatafieldIOService::dataInterfaces().

Here is the call graph for this function:

◆ readFrom()

void ApplicationModels::readFrom ( class QXmlStreamReader *  reader,
MessageService messageService 
)

Definition at line 52 of file ApplicationModels.cpp.

53 {
54  try {
55  if (m_realDataModel->getModelTag() == reader->name())
56  m_realDataModel->readFrom(reader, messageService);
57  else if (m_jobModel->getModelTag() == reader->name())
58  m_jobModel->readFrom(reader, messageService);
59  } catch (DeserializationException& ex) {
61  m_jobModel->clear();
62  reader->raiseError(ex.text());
63  }
64 }
void clear() override
Definition: JobModel.cpp:100
void readFrom(QXmlStreamReader *reader, MessageService *messageService=nullptr) override
Definition: JobModel.cpp:127
void readFrom(QXmlStreamReader *reader, MessageService *messageService=nullptr) override
virtual void clear()
QString getModelTag() const
Definition: SessionModel.h:202

References SessionModel::clear(), JobModel::clear(), SessionModel::getModelTag(), m_jobModel, m_realDataModel, JobModel::readFrom(), RealDataModel::readFrom(), and DeserializationException::text().

Referenced by ProjectDocument::readProject().

Here is the call graph for this function:

◆ realDataModel()

RealDataModel * ApplicationModels::realDataModel ( ) const

Definition at line 34 of file ApplicationModels.cpp.

35 {
36  return m_realDataModel;
37 }

References m_realDataModel.

Referenced by ProjectDocument::realDataModel().

◆ writeTo()

void ApplicationModels::writeTo ( class QXmlStreamWriter *  writer)

Writes all model in file one by one.

Definition at line 46 of file ApplicationModels.cpp.

47 {
48  m_realDataModel->writeTo(writer);
49  m_jobModel->writeTo(writer);
50 }
virtual void writeTo(QXmlStreamWriter *writer)

References m_jobModel, m_realDataModel, and SessionModel::writeTo().

Referenced by ProjectDocument::writeTo().

Here is the call graph for this function:

Member Data Documentation

◆ m_jobModel

JobModel* ApplicationModels::m_jobModel
private

Definition at line 49 of file ApplicationModels.h.

Referenced by ApplicationModels(), jobModel(), nonXMLItems(), readFrom(), and writeTo().

◆ m_realDataModel

RealDataModel* ApplicationModels::m_realDataModel
private

Definition at line 48 of file ApplicationModels.h.

Referenced by ApplicationModels(), nonXMLItems(), readFrom(), realDataModel(), and writeTo().


The documentation for this class was generated from the following files: