BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Strategy for ComponentProxyModel which hides extra level of GroupProperty. More...
Public Types | |
using | map_t = QMap< QPersistentModelIndex, QPersistentModelIndex > |
Public Member Functions | |
void | buildModelMap (SessionModel *source, ComponentProxyModel *proxy) |
void | onDataChanged (SessionModel *source, ComponentProxyModel *proxy) |
const map_t & | proxySourceParent () |
void | setRootIndex (const QModelIndex &sourceRootIndex) |
const map_t & | sourceToProxy () |
Protected Member Functions | |
QModelIndex | createProxyIndex (int nrow, int ncol, void *adata) |
Method to ask proxy to create an index using friendship of ProxyModelStrategy and ComponentProxyModel. More... | |
bool | processSourceIndex (const QModelIndex &index) |
Mapping of proxy model indices to indices in source model. More... | |
Protected Attributes | |
ComponentProxyModel * | m_proxy |
QMap< QPersistentModelIndex, QPersistentModelIndex > | m_proxySourceParent |
SessionModel * | m_source |
QPersistentModelIndex | m_sourceRootIndex |
QMap< QPersistentModelIndex, QPersistentModelIndex > | m_sourceToProxy |
Mapping of proxy model indices to indices of parent in source model. More... | |
Private Member Functions | |
bool | isGroupChildren (SessionItem *item) |
Returns true if item is a children/grandchildrent of some group item. More... | |
bool | isNewRootItem (SessionItem *item) |
Returns true if item should become new root item. More... | |
bool | isPropertyRelated (SessionItem *item) |
Returns true if item is property related to exclude top level items (ParticleLayout, Particle etc from the tree). More... | |
bool | isSubGroup (SessionItem *item) |
Returns true if item is a group property which in turn is inside of another group property. More... | |
int | parentVisibleRow (const SessionItem &item) |
void | processDefaultItem (SessionItem *item, const QPersistentModelIndex &sourceIndex) |
void | processGroupItem (SessionItem *item, const QPersistentModelIndex &sourceIndex) |
All properties of current item of group item. More... | |
void | processRootItem (SessionItem *item, const QPersistentModelIndex &sourceIndex) |
Makes SessionItem to become the only one item in a tree. More... | |
void | processSubGroupItem (SessionItem *item, const QPersistentModelIndex &sourceIndex) |
Process group property which is inside of other group property. More... | |
Strategy for ComponentProxyModel which hides extra level of GroupProperty.
Definition at line 22 of file ComponentProxyStrategy.h.
|
inherited |
Definition at line 28 of file ProxyModelStrategy.h.
|
inherited |
Definition at line 21 of file ProxyModelStrategy.cpp.
References ModelUtils::iterate_if(), ProxyModelStrategy::m_proxy, ProxyModelStrategy::m_proxySourceParent, ProxyModelStrategy::m_source, ProxyModelStrategy::m_sourceRootIndex, ProxyModelStrategy::m_sourceToProxy, and ProxyModelStrategy::processSourceIndex().
Referenced by onDataChanged().
|
protectedinherited |
Method to ask proxy to create an index using friendship of ProxyModelStrategy and ComponentProxyModel.
Definition at line 62 of file ProxyModelStrategy.cpp.
References ASSERT, and ProxyModelStrategy::m_proxy.
Referenced by processDefaultItem(), processGroupItem(), processRootItem(), IndentityProxyStrategy::processSourceIndex(), and processSubGroupItem().
|
private |
Returns true if item is a children/grandchildrent of some group item.
Definition at line 106 of file ComponentProxyStrategy.cpp.
References ModelPath::ancestor(), SessionItem::modelType(), and SessionItem::parent().
Referenced by processSourceIndex().
|
private |
Returns true if item should become new root item.
This is used when we want to show single item (Layer, Particle) on top of the tree.
Definition at line 75 of file ComponentProxyStrategy.cpp.
References SessionItem::index(), and ProxyModelStrategy::m_sourceRootIndex.
Referenced by processSourceIndex().
|
private |
Returns true if item is property related to exclude top level items (ParticleLayout, Particle etc from the tree).
Definition at line 61 of file ComponentProxyStrategy.cpp.
References SessionItem::index(), ProxyModelStrategy::m_sourceRootIndex, SessionItem::modelType(), SessionItem::parent(), and ComponentUtils::propertyRelatedTypes().
Referenced by parentVisibleRow(), and processSourceIndex().
|
private |
Returns true if item is a group property which in turn is inside of another group property.
Definition at line 93 of file ComponentProxyStrategy.cpp.
References ModelPath::ancestor(), SessionItem::modelType(), and SessionItem::parent().
Referenced by processSourceIndex().
|
virtual |
Reimplemented from ProxyModelStrategy.
Definition at line 23 of file ComponentProxyStrategy.cpp.
References ProxyModelStrategy::buildModelMap().
|
private |
Definition at line 176 of file ComponentProxyStrategy.cpp.
References SessionItem::children(), isPropertyRelated(), SessionItem::isVisible(), and SessionItem::parent().
Referenced by processDefaultItem(), processGroupItem(), and processSubGroupItem().
|
private |
Definition at line 157 of file ComponentProxyStrategy.cpp.
References ASSERT, ProxyModelStrategy::createProxyIndex(), SessionItem::isVisible(), ProxyModelStrategy::m_proxySourceParent, ProxyModelStrategy::m_sourceToProxy, and parentVisibleRow().
Referenced by processSourceIndex().
|
private |
All properties of current item of group item.
Definition at line 121 of file ComponentProxyStrategy.cpp.
References ModelPath::ancestor(), ProxyModelStrategy::createProxyIndex(), ProxyModelStrategy::m_proxySourceParent, ProxyModelStrategy::m_sourceToProxy, SessionItem::parent(), and parentVisibleRow().
Referenced by processSourceIndex().
|
private |
Makes SessionItem to become the only one item in a tree.
Definition at line 82 of file ComponentProxyStrategy.cpp.
References ProxyModelStrategy::createProxyIndex(), ProxyModelStrategy::m_proxySourceParent, and ProxyModelStrategy::m_sourceToProxy.
Referenced by processSourceIndex().
|
protectedvirtual |
Mapping of proxy model indices to indices in source model.
Implements ProxyModelStrategy.
Definition at line 29 of file ComponentProxyStrategy.cpp.
References isGroupChildren(), isNewRootItem(), isPropertyRelated(), isSubGroup(), SessionModel::itemForIndex(), ProxyModelStrategy::m_source, SessionItem::parent(), processDefaultItem(), processGroupItem(), processRootItem(), processSubGroupItem(), and SessionItem::tagFromItem().
|
private |
Process group property which is inside of other group property.
Definition at line 141 of file ComponentProxyStrategy.cpp.
References ModelPath::ancestor(), ProxyModelStrategy::createProxyIndex(), ProxyModelStrategy::m_proxySourceParent, ProxyModelStrategy::m_sourceToProxy, SessionItem::parent(), and parentVisibleRow().
Referenced by processSourceIndex().
|
inherited |
Definition at line 49 of file ProxyModelStrategy.cpp.
References ProxyModelStrategy::m_proxySourceParent.
|
inherited |
Definition at line 54 of file ProxyModelStrategy.cpp.
References ProxyModelStrategy::m_sourceRootIndex.
|
inherited |
Definition at line 44 of file ProxyModelStrategy.cpp.
References ProxyModelStrategy::m_sourceToProxy.
|
protectedinherited |
Definition at line 52 of file ProxyModelStrategy.h.
Referenced by ProxyModelStrategy::buildModelMap(), and ProxyModelStrategy::createProxyIndex().
|
protectedinherited |
Definition at line 48 of file ProxyModelStrategy.h.
Referenced by ProxyModelStrategy::buildModelMap(), processDefaultItem(), processGroupItem(), processRootItem(), IndentityProxyStrategy::processSourceIndex(), processSubGroupItem(), and ProxyModelStrategy::proxySourceParent().
|
protectedinherited |
Definition at line 51 of file ProxyModelStrategy.h.
Referenced by ProxyModelStrategy::buildModelMap(), and processSourceIndex().
|
protectedinherited |
Definition at line 50 of file ProxyModelStrategy.h.
Referenced by ProxyModelStrategy::buildModelMap(), isNewRootItem(), isPropertyRelated(), and ProxyModelStrategy::setRootIndex().
|
protectedinherited |
Mapping of proxy model indices to indices of parent in source model.
Definition at line 46 of file ProxyModelStrategy.h.
Referenced by ProxyModelStrategy::buildModelMap(), processDefaultItem(), processGroupItem(), processRootItem(), IndentityProxyStrategy::processSourceIndex(), processSubGroupItem(), and ProxyModelStrategy::sourceToProxy().