BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Proxy model to adjust SessionModel for component editor (right bottom corner of SampleView and similar). More...
Public Member Functions | |
ComponentProxyModel (QObject *parent=nullptr) | |
int | columnCount (const QModelIndex &parent={}) const |
bool | hasChildren (const QModelIndex &parent) const |
QModelIndex | index (int row, int column, const QModelIndex &parent={}) const |
QModelIndex | mapFromSource (const QModelIndex &sourceIndex) const |
QModelIndex | mapToSource (const QModelIndex &proxyIndex) const |
QModelIndex | parent (const QModelIndex &child) const |
int | rowCount (const QModelIndex &parent={}) const |
void | setProxyStrategy (ProxyModelStrategy *strategy) |
void | setRootIndex (const QModelIndex &sourceRootIndex) |
void | setSessionModel (SessionModel *model) |
Private Slots | |
void | sourceDataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles={}) |
void | sourceRowsInserted (const QModelIndex &parent, int start, int end) |
void | sourceRowsRemoved (const QModelIndex &parent, int start, int end) |
Private Member Functions | |
void | buildModelMap () |
Main method to build the map of persistent indeses. More... | |
void | updateModelMap () |
Private Attributes | |
SessionModel * | m_model |
std::unique_ptr< ProxyModelStrategy > | m_proxyStrategy |
Friends | |
class | ProxyModelStrategy |
Proxy model to adjust SessionModel for component editor (right bottom corner of SampleView and similar).
The model hides all SessionItems which are not PropertyItems. The model hides GroupPropertyItem children and shows grand-children of currently selected item one level up.
Definition at line 33 of file ComponentProxyModel.h.
ComponentProxyModel::ComponentProxyModel | ( | QObject * | parent = nullptr | ) |
Definition at line 22 of file ComponentProxyModel.cpp.
|
private |
Main method to build the map of persistent indeses.
Definition at line 178 of file ComponentProxyModel.cpp.
References m_model, and m_proxyStrategy.
Referenced by setProxyStrategy(), setRootIndex(), setSessionModel(), sourceRowsInserted(), and sourceRowsRemoved().
int ComponentProxyModel::columnCount | ( | const QModelIndex & | parent = {} | ) | const |
Definition at line 130 of file ComponentProxyModel.cpp.
References SessionFlags::MAX_COLUMNS, and parent().
bool ComponentProxyModel::hasChildren | ( | const QModelIndex & | parent | ) | const |
Definition at line 137 of file ComponentProxyModel.cpp.
References mapToSource(), parent(), and rowCount().
QModelIndex ComponentProxyModel::index | ( | int | row, |
int | column, | ||
const QModelIndex & | parent = {} |
||
) | const |
Definition at line 88 of file ComponentProxyModel.cpp.
References m_proxyStrategy, mapToSource(), and parent().
QModelIndex ComponentProxyModel::mapFromSource | ( | const QModelIndex & | sourceIndex | ) | const |
Definition at line 80 of file ComponentProxyModel.cpp.
References m_proxyStrategy.
Referenced by parent(), ComponentTreeView::setRootIndex(), and sourceDataChanged().
QModelIndex ComponentProxyModel::mapToSource | ( | const QModelIndex & | proxyIndex | ) | const |
Definition at line 72 of file ComponentProxyModel.cpp.
References m_proxyStrategy.
Referenced by hasChildren(), index(), ComponentTreeView::onCustomContextMenuRequested(), and rowCount().
QModelIndex ComponentProxyModel::parent | ( | const QModelIndex & | child | ) | const |
Definition at line 104 of file ComponentProxyModel.cpp.
References m_proxyStrategy, and mapFromSource().
Referenced by columnCount(), hasChildren(), index(), rowCount(), sourceRowsInserted(), and sourceRowsRemoved().
int ComponentProxyModel::rowCount | ( | const QModelIndex & | parent = {} | ) | const |
Definition at line 113 of file ComponentProxyModel.cpp.
References m_proxyStrategy, mapToSource(), and parent().
Referenced by hasChildren().
void ComponentProxyModel::setProxyStrategy | ( | ProxyModelStrategy * | strategy | ) |
Definition at line 66 of file ComponentProxyModel.cpp.
References buildModelMap(), and m_proxyStrategy.
void ComponentProxyModel::setRootIndex | ( | const QModelIndex & | sourceRootIndex | ) |
Definition at line 60 of file ComponentProxyModel.cpp.
References buildModelMap(), and m_proxyStrategy.
Referenced by ComponentTreeView::setRootIndex().
void ComponentProxyModel::setSessionModel | ( | SessionModel * | model | ) |
Definition at line 30 of file ComponentProxyModel.cpp.
References buildModelMap(), m_model, sourceDataChanged(), sourceRowsInserted(), and sourceRowsRemoved().
Referenced by ComponentTreeView::setModel().
|
privateslot |
Definition at line 146 of file ComponentProxyModel.cpp.
References ASSERT, SessionModel::itemForIndex(), m_model, mapFromSource(), and updateModelMap().
Referenced by setSessionModel().
|
privateslot |
Definition at line 160 of file ComponentProxyModel.cpp.
References buildModelMap(), and parent().
Referenced by setSessionModel().
|
privateslot |
Definition at line 168 of file ComponentProxyModel.cpp.
References buildModelMap(), and parent().
Referenced by setSessionModel().
|
private |
Definition at line 186 of file ComponentProxyModel.cpp.
References m_model, and m_proxyStrategy.
Referenced by sourceDataChanged().
|
friend |
Definition at line 36 of file ComponentProxyModel.h.
|
private |
Definition at line 67 of file ComponentProxyModel.h.
Referenced by buildModelMap(), setSessionModel(), sourceDataChanged(), and updateModelMap().
|
private |
Definition at line 68 of file ComponentProxyModel.h.
Referenced by buildModelMap(), index(), mapFromSource(), mapToSource(), parent(), rowCount(), setProxyStrategy(), setRootIndex(), and updateModelMap().