BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
InstrumentsEditController.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Device/InstrumentsEditController.cpp
6 //! @brief Implements class InstrumentsEditController
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 
17 
19  : m_instruments(instruments)
20 {
21 }
22 
24 {
25  return m_instruments;
26 }
27 
29 {
30  m_instruments->removeInstrument(instrument);
32 }
33 
35  const QString& name)
36 {
37  InstrumentItem* copy = m_instruments->insertCopy(*instrument);
38  copy->setInstrumentName(name);
40  return copy;
41 }
42 
44 {
45  if (instrument->instrumentName() != name) {
46  instrument->setInstrumentName(name);
47  emit instrumentNameChanged(instrument);
48  emit instrumentChanged(instrument);
49  }
50 }
51 
53  const RealDataItem* realDataItem)
54 {
55  instrument->updateToRealData(realDataItem);
56  emit instrumentChanged(instrument);
57 }
58 
60 {
61  emit instrumentChanged(instrument);
62 }
Defines class InstrumentItem and all its children.
Defines class InstrumentsEditController.
void removeInstrument(InstrumentItem *instrument)
InstrumentItem * insertCopy(const InstrumentItem &source)
Inserts a deep copy (also of any non xml data in a pointwise axis) The id will not be copied,...
Abstract base class for instrument-specific item classes.
virtual void updateToRealData(const RealDataItem *item)=0
QString instrumentName() const
void setInstrumentName(const QString &instrumentName)
InstrumentItem * addCopy(const InstrumentItem *instrument, const QString &name)
Copy an instrument, set its name and emit the respective signal.
void instrumentNameChanged(const InstrumentItem *instrument)
Signals name change of the given instrument.
void instrumentAddedOrRemoved()
Signals a change in the list of instruments.
void instrumentChanged(const InstrumentItem *instrument)
Signals any change in the settings of the given instrument.
void notifyInstrumentChanged(InstrumentItem *instrument)
Simply emits the instrumentChanged signal. Call this whenever you change an instrument's data without...
void setInstrumentName(InstrumentItem *instrument, const QString &name)
Set an instrument's name and emit the respective signal.
void removeInstrument(InstrumentItem *instrument)
Add an instrument and emit the respective signal.
InstrumentsEditController(InstrumentCollection *instruments)
InstrumentCollection * collectedItems()
The list of existing instruments.
void updateInstrumentToRealDataItem(InstrumentItem *instrument, const RealDataItem *realDataItem)
Calls the instrument's updateToRealData and emits the respective signal.
InstrumentCollection * m_instruments
The edited/controlled instruments. This pointer is borrowed, not owned.
Provides access to experimental data, for display and fitting. Owns an AbstractDataLoader.
Definition: RealDataItem.h:33
QString const & name(EShape k)
Definition: particles.cpp:20