BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Definition at line 24 of file ModelMapper.h.
Public Slots | |
void | onBeginRemoveRows (const QModelIndex &parent, int first, int last) |
void | onDataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles={}) |
void | onRowRemoved (const QModelIndex &parent, int first, int last) |
void | onRowsInserted (const QModelIndex &parent, int first, int last) |
Public Member Functions | |
ModelMapper (QObject *parent=nullptr) | |
void | callOnItemDestroy () |
Notifies subscribers if an item owning given mapper is about to be destroyed. More... | |
void | setActive (bool state) |
void | setItem (SessionItem *item) |
void | setOnAboutToRemoveChild (std::function< void(SessionItem *)> f, const void *caller=nullptr) |
void | setOnChildPropertyChange (std::function< void(SessionItem *, QString)> f, const void *caller=nullptr) |
Calls back on child property change, report childItem and property name. More... | |
void | setOnChildrenChange (std::function< void(SessionItem *)> f, const void *caller=nullptr) |
Calls back when number of children has changed, reports newChild. newChild == nullptr denotes the case when number of children has decreased. More... | |
void | setOnItemDestroy (std::function< void(SessionItem *)> f, const void *caller=nullptr) |
void | setOnPropertyChange (std::function< void(QString)> f, const void *caller=nullptr) |
void | setOnPropertyChange (std::function< void(SessionItem *, QString)> f, const void *caller=nullptr) |
void | setOnValueChange (std::function< void(void)> f, const void *caller=nullptr) |
void | unsubscribe (const void *caller) |
Cancels all subscriptions of given caller. More... | |
Private Types | |
using | call_item_str_t = std::pair< std::function< void(SessionItem *, QString)>, const void * > |
using | call_item_t = std::pair< std::function< void(SessionItem *)>, const void * > |
using | call_str_t = std::pair< std::function< void(QString)>, const void * > |
using | call_t = std::pair< std::function< void(void)>, const void * > |
Private Member Functions | |
void | callOnAboutToRemoveChild (SessionItem *item) |
void | callOnChildPropertyChange (SessionItem *item, const QString &name) |
void | callOnChildrenChange (SessionItem *item) |
void | callOnPropertyChange (const QString &name) |
void | callOnValueChange () |
template<class U > | |
void | clean_container (U &v, const void *caller) |
removes all callbacks related to given caller More... | |
void | clearMapper () |
int | nestlingDepth (SessionItem *item, int level=0) |
void | setModel (SessionModel *model) |
Private Attributes | |
QModelIndex | m_aboutToDelete |
bool | m_active |
SessionItem * | m_item |
SessionModel * | m_model |
std::vector< call_item_t > | m_onAboutToRemoveChild |
std::vector< call_item_str_t > | m_onChildPropertyChange |
std::vector< call_item_t > | m_onChildrenChange |
std::vector< call_item_t > | m_onItemDestroy |
std::vector< call_item_str_t > | m_onPropertyChange |
std::vector< call_t > | m_onValueChange |
|
private |
Definition at line 86 of file ModelMapper.h.
|
private |
Definition at line 85 of file ModelMapper.h.
|
private |
Definition at line 84 of file ModelMapper.h.
|
private |
Definition at line 83 of file ModelMapper.h.
ModelMapper::ModelMapper | ( | QObject * | parent = nullptr | ) |
Definition at line 18 of file ModelMapper.cpp.
|
private |
Definition at line 145 of file ModelMapper.cpp.
References m_active, and m_onAboutToRemoveChild.
Referenced by onBeginRemoveRows().
|
private |
Definition at line 131 of file ModelMapper.cpp.
References m_active, m_onChildPropertyChange, and GUI::RealSpace::Particles::name().
Referenced by onDataChanged().
|
private |
Definition at line 138 of file ModelMapper.cpp.
References m_active, and m_onChildrenChange.
Referenced by onRowRemoved(), and onRowsInserted().
void ModelMapper::callOnItemDestroy | ( | ) |
Notifies subscribers if an item owning given mapper is about to be destroyed.
Definition at line 153 of file ModelMapper.cpp.
References m_active, m_item, and m_onItemDestroy.
|
private |
Definition at line 124 of file ModelMapper.cpp.
References m_active, m_item, m_onPropertyChange, and GUI::RealSpace::Particles::name().
Referenced by onDataChanged().
|
private |
Definition at line 117 of file ModelMapper.cpp.
References m_active, and m_onValueChange.
Referenced by onDataChanged().
|
inlineprivate |
removes all callbacks related to given caller
Definition at line 98 of file ModelMapper.h.
Referenced by unsubscribe().
|
private |
Definition at line 160 of file ModelMapper.cpp.
References m_item, m_onAboutToRemoveChild, m_onChildPropertyChange, m_onChildrenChange, m_onItemDestroy, m_onPropertyChange, m_onValueChange, and setModel().
Referenced by onRowRemoved().
|
private |
Definition at line 107 of file ModelMapper.cpp.
References m_item, m_model, SessionItem::parentItem(), and SessionModel::rootItem().
Referenced by onBeginRemoveRows(), onDataChanged(), onRowRemoved(), and onRowsInserted().
|
slot |
Definition at line 210 of file ModelMapper.cpp.
References callOnAboutToRemoveChild(), SessionModel::index(), SessionModel::itemForIndex(), m_aboutToDelete, m_item, m_model, and nestlingDepth().
Referenced by setModel().
|
slot |
Definition at line 172 of file ModelMapper.cpp.
References callOnChildPropertyChange(), callOnPropertyChange(), callOnValueChange(), SessionModel::itemForIndex(), m_item, m_model, nestlingDepth(), SessionItem::parentItem(), and SessionItem::tagFromItem().
Referenced by setModel().
|
slot |
Definition at line 223 of file ModelMapper.cpp.
References callOnChildrenChange(), clearMapper(), SessionModel::index(), SessionModel::itemForIndex(), m_aboutToDelete, m_model, and nestlingDepth().
Referenced by setModel().
|
slot |
Definition at line 202 of file ModelMapper.cpp.
References callOnChildrenChange(), SessionModel::index(), SessionModel::itemForIndex(), m_model, and nestlingDepth().
Referenced by setModel().
|
inline |
void ModelMapper::setItem | ( | SessionItem * | item | ) |
Definition at line 26 of file ModelMapper.cpp.
References m_item, SessionItem::model(), and setModel().
|
private |
Definition at line 88 of file ModelMapper.cpp.
References m_model, onBeginRemoveRows(), onDataChanged(), onRowRemoved(), and onRowsInserted().
Referenced by clearMapper(), and setItem().
void ModelMapper::setOnAboutToRemoveChild | ( | std::function< void(SessionItem *)> | f, |
const void * | caller = nullptr |
||
) |
Definition at line 72 of file ModelMapper.cpp.
References m_onAboutToRemoveChild.
Referenced by ProjectionsPlot::subscribeToItem().
void ModelMapper::setOnChildPropertyChange | ( | std::function< void(SessionItem *, QString)> | f, |
const void * | caller = nullptr |
||
) |
Calls back on child property change, report childItem and property name.
Definition at line 53 of file ModelMapper.cpp.
References m_onChildPropertyChange.
Referenced by PropertyRepeater::addItem(), SpecularDataPropertyWidget::setCurrentItem(), IntensityDataPropertyWidget::setItem(), Plot1D::subscribeToItem(), SpecularPlot::subscribeToItem(), ColorMap::subscribeToItem(), and ProjectionsPlot::subscribeToItem().
void ModelMapper::setOnChildrenChange | ( | std::function< void(SessionItem *)> | f, |
const void * | caller = nullptr |
||
) |
Calls back when number of children has changed, reports newChild. newChild == nullptr denotes the case when number of children has decreased.
Definition at line 62 of file ModelMapper.cpp.
References m_onChildrenChange.
Referenced by ProjectionsPlot::subscribeToItem().
void ModelMapper::setOnItemDestroy | ( | std::function< void(SessionItem *)> | f, |
const void * | caller = nullptr |
||
) |
Definition at line 67 of file ModelMapper.cpp.
References m_onItemDestroy.
Referenced by FitParameterModel::FitParameterModel(), IShape2DView::IShape2DView(), PropertyRepeater::addItem(), IntensityDataPropertyWidget::setItem(), and SessionItemController::setItem().
void ModelMapper::setOnPropertyChange | ( | std::function< void(QString)> | f, |
const void * | caller = nullptr |
||
) |
Definition at line 39 of file ModelMapper.cpp.
References m_onPropertyChange.
Referenced by Data1DViewItem::Data1DViewItem(), FitParameterItem::FitParameterItem(), IShape2DView::IShape2DView(), PropertyRepeater::addItem(), MaskEditorPropertyPanel::addMaskCheckBox(), MaskEditorPropertyPanel::addMaskSpinBox(), SpecularDataPropertyWidget::setCurrentItem(), IntensityDataPropertyWidget::setItem(), FitSessionController::setItem(), RunFitControlWidget::subscribeToItem(), IntensityDataCanvas::subscribeToItem(), FitFlowWidget::subscribeToItem(), Plot1D::subscribeToItem(), SpecularPlot::subscribeToItem(), ColorMap::subscribeToItem(), and ProjectionsPlot::subscribeToItem().
void ModelMapper::setOnPropertyChange | ( | std::function< void(SessionItem *, QString)> | f, |
const void * | caller = nullptr |
||
) |
Definition at line 45 of file ModelMapper.cpp.
References m_onPropertyChange.
void ModelMapper::setOnValueChange | ( | std::function< void(void)> | f, |
const void * | caller = nullptr |
||
) |
Definition at line 34 of file ModelMapper.cpp.
References m_onValueChange.
Referenced by GroupItem::GroupItem(), SpecularPlot::subscribeToItem(), ColorMap::subscribeToItem(), and ProjectionsPlot::subscribeToItem().
void ModelMapper::unsubscribe | ( | const void * | caller | ) |
Cancels all subscriptions of given caller.
Definition at line 78 of file ModelMapper.cpp.
References clean_container(), m_onAboutToRemoveChild, m_onChildPropertyChange, m_onChildrenChange, m_onItemDestroy, m_onPropertyChange, and m_onValueChange.
Referenced by FitParameterModel::~FitParameterModel(), IntensityDataPropertyWidget::~IntensityDataPropertyWidget(), IShape2DView::disconnectFromItem(), SessionItemController::onControllerDestroy(), SpecularDataPropertyWidget::setCurrentItem(), MaskEditorPropertyPanel::setCurrentMaskItem(), IntensityDataPropertyWidget::setItem(), SessionItemController::setItem(), SessionItemController::unsubscribe(), RunFitControlWidget::unsubscribeFromChildren(), and ProjectionsPlot::unsubscribeFromChildren().
|
private |
Definition at line 94 of file ModelMapper.h.
Referenced by onBeginRemoveRows(), and onRowRemoved().
|
private |
Definition at line 79 of file ModelMapper.h.
Referenced by callOnAboutToRemoveChild(), callOnChildPropertyChange(), callOnChildrenChange(), callOnItemDestroy(), callOnPropertyChange(), callOnValueChange(), and setActive().
|
private |
Definition at line 81 of file ModelMapper.h.
Referenced by callOnItemDestroy(), callOnPropertyChange(), clearMapper(), nestlingDepth(), onBeginRemoveRows(), onDataChanged(), and setItem().
|
private |
Definition at line 80 of file ModelMapper.h.
Referenced by nestlingDepth(), onBeginRemoveRows(), onDataChanged(), onRowRemoved(), onRowsInserted(), and setModel().
|
private |
Definition at line 93 of file ModelMapper.h.
Referenced by callOnAboutToRemoveChild(), clearMapper(), setOnAboutToRemoveChild(), and unsubscribe().
|
private |
Definition at line 90 of file ModelMapper.h.
Referenced by callOnChildPropertyChange(), clearMapper(), setOnChildPropertyChange(), and unsubscribe().
|
private |
Definition at line 91 of file ModelMapper.h.
Referenced by callOnChildrenChange(), clearMapper(), setOnChildrenChange(), and unsubscribe().
|
private |
Definition at line 92 of file ModelMapper.h.
Referenced by callOnItemDestroy(), clearMapper(), setOnItemDestroy(), and unsubscribe().
|
private |
Definition at line 89 of file ModelMapper.h.
Referenced by callOnPropertyChange(), clearMapper(), setOnPropertyChange(), and unsubscribe().
|
private |
Definition at line 88 of file ModelMapper.h.
Referenced by callOnValueChange(), clearMapper(), setOnValueChange(), and unsubscribe().