Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
List of all members | Public Types | Properties | Public Slots | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
qMRMLSortFilterProxyModel Class Reference

#include <Libs/MRML/Widgets/qMRMLSortFilterProxyModel.h>

Inheritance diagram for qMRMLSortFilterProxyModel:
Inheritance graph
[legend]
Collaboration diagram for qMRMLSortFilterProxyModel:
Collaboration graph
[legend]

Public Types

enum  FilterType { HideAll = 0, ShowAll, UseFilters }
 
typedef QSortFilterProxyModel Superclass
 

Properties

FilterType filterType
 
QStringList hiddenNodeIDs
 
bool hideAll
 
QStringList hideChildNodeTypes
 
QString hideNodesUnaffiliatedWithNodeID
 
QStringList nodeTypes
 
bool showAll
 
bool showChildNodeTypes
 
bool showHidden
 
QStringList showHiddenForTypes
 
QStringList visibleNodeIDs
 

Public Slots

void setFilterType (FilterType filterType)
 
void setHideAll (bool hide)
 
void setShowAll (bool show)
 
void setShowHidden (bool)
 

Public Member Functions

Q_INVOKABLE void addAttribute (const QString &nodeType, const QString &attributeName, const QVariant &attributeValue=QVariant())
 
Q_INVOKABLE QVariant attributeFilter (const QString &nodeType, const QString &attributeName) const
 
FilterType filterType () const
 
QStringList hiddenNodeIDs () const
 
bool hideAll () const
 
QStringList hideChildNodeTypes () const
 
QString hideNodesUnaffiliatedWithNodeID () const
 
Q_INVOKABLE QModelIndex indexFromMRMLNode (vtkMRMLNode *node, int column=0) const
 Retrieve an index for a given vtkMRMLNode. More...
 
Q_INVOKABLE vtkMRMLNodemrmlNodeFromIndex (const QModelIndex &index) const
 Retrieve the associated vtkMRMLNode. More...
 
vtkMRMLScenemrmlScene () const
 Retrieve the associated MRML scene. More...
 
Q_INVOKABLE QModelIndex mrmlSceneIndex () const
 Retrieve the MRML scene index. More...
 
QStringList nodeTypes () const
 
 qMRMLSortFilterProxyModel (QObject *parent=0)
 
Q_INVOKABLE void removeAttribute (const QString &nodeType, const QString &attributeName)
 
Q_INVOKABLE qMRMLSceneModelsceneModel () const
 Return the scene model used as input if any. More...
 
void setHiddenNodeIDs (const QStringList &nodeIDsToHide)
 
void setHideChildNodeTypes (const QStringList &nodeTypes)
 
void setHideNodesUnaffiliatedWithNodeID (const QString &nodeID)
 
void setNodeTypes (const QStringList &nodeTypes)
 
void setShowChildNodeTypes (bool show)
 
void setShowHiddenForTypes (const QStringList &nodeTypes)
 
void setVisibleNodeIDs (const QStringList &nodeIDsToShow)
 
bool showAll () const
 
bool showChildNodeTypes () const
 
bool showHidden () const
 
QStringList showHiddenForTypes () const
 
QStringList visibleNodeIDs () const
 
virtual ~qMRMLSortFilterProxyModel ()
 

Protected Types

enum  AcceptType { Reject = 0, Accept, RejectButPotentiallyAcceptable, AcceptButPotentiallyRejectable }
 

Protected Member Functions

virtual AcceptType filterAcceptsNode (vtkMRMLNode *node) const
 
virtual bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const
 
QStandardItem * sourceItem (const QModelIndex &index) const
 

Protected Attributes

QScopedPointer< qMRMLSortFilterProxyModelPrivate > d_ptr
 

Detailed Description

Filter nodes based on their types and attributes Support filtering QSortFilterProxyModel::filterRegExp

Definition at line 43 of file qMRMLSortFilterProxyModel.h.

Member Typedef Documentation

◆ Superclass

typedef QSortFilterProxyModel qMRMLSortFilterProxyModel::Superclass

Definition at line 121 of file qMRMLSortFilterProxyModel.h.

Member Enumeration Documentation

◆ AcceptType

This enum type is used to describe the behavior of a node with regard to filtering:

  • Reject if the node should not be visible and has no chance of being visible.
  • Accept if the node should be visible and will always be.
  • RejectButPotentiallyAcceptable if the node should not be visible but has the potential for being visible. This can happen if a property is changed. The node should be observed by the model and invalidate the filter when modified to make sure its visibility state is correct.
  • AcceptButPotentiallyRejectable if the node should be visible but has the potential for being hidden. See RejectButPotentiallyAcceptable.
Enumerator
Reject 
Accept 
RejectButPotentiallyAcceptable 
AcceptButPotentiallyRejectable 

Definition at line 247 of file qMRMLSortFilterProxyModel.h.

◆ FilterType

Enumerator
HideAll 
ShowAll 
UseFilters 

Definition at line 114 of file qMRMLSortFilterProxyModel.h.

Property Documentation

◆ filterType

FilterType qMRMLSortFilterProxyModel::filterType
readwrite

This property controls whether the proxy applies its filter or if it shows or hides all the nodes. UseFilters by defaults.

See also
showAll, hideAll, hiddenNodeIDs, visibleNodeIDs

Definition at line 84 of file qMRMLSortFilterProxyModel.h.

◆ hiddenNodeIDs

QStringList qMRMLSortFilterProxyModel::hiddenNodeIDs
readwrite

This property forces nodes to be hidden despite their ability to be visible. Only filterType takes precedence or hiddenNodeIDs. It takes precedence over visibleNodeIDs.

See also
visibleNodeIDs, filterType, showHidden

Definition at line 100 of file qMRMLSortFilterProxyModel.h.

◆ hideAll

bool qMRMLSortFilterProxyModel::hideAll
readwrite

This property controls whether all the nodes are hidden or not, bypassing any filter. False by default.

Definition at line 94 of file qMRMLSortFilterProxyModel.h.

◆ hideChildNodeTypes

QStringList qMRMLSortFilterProxyModel::hideChildNodeTypes
readwrite

This property controls the nodes to hide by node type Any node of type nodeType are visible except the ones also of type hideChildNodeTypes. e.g.: nodeTypes = vtkMRMLVolumeNode, showChildNodeTypes = true, hideChildNodeTypes = vtkMRMLDiffusionWeightedVolumeNode -> all the nodes of type vtkMRMLScalarVolumeNode, vtkMRMLTensorVolumeNode, vtkMRMLDiffusionImageVolumeNode... (but not vtkMRMLDiffusionWeightedVolumeNode) will be visible.

Definition at line 78 of file qMRMLSortFilterProxyModel.h.

◆ hideNodesUnaffiliatedWithNodeID

QString qMRMLSortFilterProxyModel::hideNodesUnaffiliatedWithNodeID
readwrite

This property controls whether nodes unaffiliated with a given node ID are hidden or not. All the nodes are visible (empty string) by default.

Definition at line 111 of file qMRMLSortFilterProxyModel.h.

◆ nodeTypes

QStringList qMRMLSortFilterProxyModel::nodeTypes
readwrite

This property controls which node is visible. The node class name must be provided. An empty list means all the nodes are visible (default).

Definition at line 51 of file qMRMLSortFilterProxyModel.h.

◆ showAll

bool qMRMLSortFilterProxyModel::showAll
readwrite

This property controls whether all the nodes are visible or not, bypassing any filter. False by default

See also
filterType, hideAll

Definition at line 90 of file qMRMLSortFilterProxyModel.h.

◆ showChildNodeTypes

bool qMRMLSortFilterProxyModel::showChildNodeTypes
readwrite

This property controls whether nodeType subclasses are visible. If showChildNodeTypes is false and nodeTypes is vtkMRMLVolumeNode then vtkMRMLScalarVolumeNode are not visible. True by default.

Definition at line 68 of file qMRMLSortFilterProxyModel.h.

◆ showHidden

bool qMRMLSortFilterProxyModel::showHidden
readwrite

This property controls whether the nodes with the HideFromEditor flag on are filtered by the proxy model or not. False by default.

See also
showHiddenForTypes

Definition at line 57 of file qMRMLSortFilterProxyModel.h.

◆ showHiddenForTypes

QStringList qMRMLSortFilterProxyModel::showHiddenForTypes
readwrite

This property overrides the behavior of showHidden for specific types. Empty by default.

See also
showHidden

Definition at line 62 of file qMRMLSortFilterProxyModel.h.

◆ visibleNodeIDs

QStringList qMRMLSortFilterProxyModel::visibleNodeIDs
readwrite

This property forces nodes to be visible even if they should be hidden based on the filter rules. Only filterType and hiddenNodeIDs can take precedence over this property.

See also
hiddenNodeIDs, filterType, showHidden

Definition at line 106 of file qMRMLSortFilterProxyModel.h.

Constructor & Destructor Documentation

◆ qMRMLSortFilterProxyModel()

qMRMLSortFilterProxyModel::qMRMLSortFilterProxyModel ( QObject *  parent = 0)

◆ ~qMRMLSortFilterProxyModel()

virtual qMRMLSortFilterProxyModel::~qMRMLSortFilterProxyModel ( )
virtual

Member Function Documentation

◆ addAttribute()

Q_INVOKABLE void qMRMLSortFilterProxyModel::addAttribute ( const QString &  nodeType,
const QString &  attributeName,
const QVariant &  attributeValue = QVariant() 
)

Add node type attribute that filter the nodes to display. The default of a null QVariant means that any non null attributeValue will match

◆ attributeFilter()

Q_INVOKABLE QVariant qMRMLSortFilterProxyModel::attributeFilter ( const QString &  nodeType,
const QString &  attributeName 
) const

Return the current attribute filter for the given node type.

See also
addAttribute, removeAttribute

◆ filterAcceptsNode()

virtual AcceptType qMRMLSortFilterProxyModel::filterAcceptsNode ( vtkMRMLNode node) const
protectedvirtual

This method returns whether the node should be visible or hidden from the view. It returns the behavior of the node with regard to the filters.

See also
filterAcceptRow(), AcceptType

Reimplemented in qMRMLSortFilterHierarchyProxyModel.

◆ filterAcceptsRow()

virtual bool qMRMLSortFilterProxyModel::filterAcceptsRow ( int  source_row,
const QModelIndex &  source_parent 
) const
protectedvirtual

Returns true if the item in the row indicated by the given source_row and source_parent should be included in the model; otherwise returns false. This method test each node via filterAcceptsNode and observe the nodes that have a potential for having their visibility changed. This method is final, it is not meant to be overwritten. If for some reason a node has not been observed but its visibility has changed, the filter can be refresh by calling a\ invalidate()

See also
filterAcceptsNode(), AcceptType, invalidate()

◆ filterType()

FilterType qMRMLSortFilterProxyModel::filterType ( ) const

Return the current filter type.

See also
filterType, setFilterType()

◆ hiddenNodeIDs()

QStringList qMRMLSortFilterProxyModel::hiddenNodeIDs ( ) const

Return the list of nodes to hide.

See also
hiddenNodeIDs, setHiddenNodeIDs()

◆ hideAll()

bool qMRMLSortFilterProxyModel::hideAll ( ) const

Return true if all the nodes are hidden

See also
hideAll, setHideAll()

◆ hideChildNodeTypes()

QStringList qMRMLSortFilterProxyModel::hideChildNodeTypes ( ) const

◆ hideNodesUnaffiliatedWithNodeID()

QString qMRMLSortFilterProxyModel::hideNodesUnaffiliatedWithNodeID ( ) const

Return the node ID used to filter out nodes that are not associated to it.

See also
hideNodesUnaffiliatedWithNodeID, setHideNodesUnaffiliatedWithNodeID()

◆ indexFromMRMLNode()

Q_INVOKABLE QModelIndex qMRMLSortFilterProxyModel::indexFromMRMLNode ( vtkMRMLNode node,
int  column = 0 
) const

Retrieve an index for a given vtkMRMLNode.

◆ mrmlNodeFromIndex()

Q_INVOKABLE vtkMRMLNode* qMRMLSortFilterProxyModel::mrmlNodeFromIndex ( const QModelIndex &  index) const

Retrieve the associated vtkMRMLNode.

◆ mrmlScene()

vtkMRMLScene* qMRMLSortFilterProxyModel::mrmlScene ( ) const

Retrieve the associated MRML scene.

◆ mrmlSceneIndex()

Q_INVOKABLE QModelIndex qMRMLSortFilterProxyModel::mrmlSceneIndex ( ) const

Retrieve the MRML scene index.

◆ nodeTypes()

QStringList qMRMLSortFilterProxyModel::nodeTypes ( ) const

Set/Get node types to display in the list NodeTypes are the class names, i.e. vtkMRMLViewNode, vtkMRMLTransformNode

◆ removeAttribute()

Q_INVOKABLE void qMRMLSortFilterProxyModel::removeAttribute ( const QString &  nodeType,
const QString &  attributeName 
)

Remove node type attribute filtering the displayed nodes

See also
addAttribute

◆ sceneModel()

Q_INVOKABLE qMRMLSceneModel* qMRMLSortFilterProxyModel::sceneModel ( ) const

Return the scene model used as input if any.

◆ setFilterType

void qMRMLSortFilterProxyModel::setFilterType ( FilterType  filterType)
slot

Set the filter type.

See also
filterType, filterType()

◆ setHiddenNodeIDs()

void qMRMLSortFilterProxyModel::setHiddenNodeIDs ( const QStringList &  nodeIDsToHide)

Set the list of nodes to hide.

See also
hiddenNodeIDs, hiddenNodeIDs()

◆ setHideAll

void qMRMLSortFilterProxyModel::setHideAll ( bool  hide)
slot

Set whether all the nodes should be hidden or not.

See also
hideAll, hideAll()

◆ setHideChildNodeTypes()

void qMRMLSortFilterProxyModel::setHideChildNodeTypes ( const QStringList &  nodeTypes)

If a node is a nodeType, hide the node if it is also a ExcludedChildNodeType. (this can happen if nodeType is a mother class of ExcludedChildNodeType)

See also
hideChildNodeTypes, hideChildNodeTypes()

◆ setHideNodesUnaffiliatedWithNodeID()

void qMRMLSortFilterProxyModel::setHideNodesUnaffiliatedWithNodeID ( const QString &  nodeID)

Set the node ID used to filter out nodes that are not associated to it. Recompute the filtering.

See also
hideNodesUnaffiliatedWithNodeID, hideNodesUnaffiliatedWithNodeID()

◆ setNodeTypes()

void qMRMLSortFilterProxyModel::setNodeTypes ( const QStringList &  nodeTypes)

◆ setShowAll

void qMRMLSortFilterProxyModel::setShowAll ( bool  show)
slot

Set whether all the nodes should be visible or not.

See also
showAll, showAll()

◆ setShowChildNodeTypes()

void qMRMLSortFilterProxyModel::setShowChildNodeTypes ( bool  show)

Display or not the nodes that are excluded by the ExcludedChildNodeTypes list. true by default.

◆ setShowHidden

void qMRMLSortFilterProxyModel::setShowHidden ( bool  )
slot

Set the showHidden flag.

See also
showHidden, showHidden()

◆ setShowHiddenForTypes()

void qMRMLSortFilterProxyModel::setShowHiddenForTypes ( const QStringList &  nodeTypes)

◆ setVisibleNodeIDs()

void qMRMLSortFilterProxyModel::setVisibleNodeIDs ( const QStringList &  nodeIDsToShow)

Set the list of nodes to force visibility.

See also
visibleNodeIDs, visibleNodeIDs()

◆ showAll()

bool qMRMLSortFilterProxyModel::showAll ( ) const

Return true if all the nodes are visible.

See also
showAll, setShowAll()

◆ showChildNodeTypes()

bool qMRMLSortFilterProxyModel::showChildNodeTypes ( ) const

◆ showHidden()

bool qMRMLSortFilterProxyModel::showHidden ( ) const

If a vtkMRMLNode has the property HideFromEditors set to true, bypass the property and show the node anyway.

See also
setShowHiddenForTypes, showHiddenForTypes

◆ showHiddenForTypes()

QStringList qMRMLSortFilterProxyModel::showHiddenForTypes ( ) const

Give more control over the types of MRML node you want to force the display even if their HideFromEditors property is true. Don't do anything if the list is empty.

See also
setShowHiddenForTypes, showHiddenForTypes

◆ sourceItem()

QStandardItem* qMRMLSortFilterProxyModel::sourceItem ( const QModelIndex &  index) const
protected

◆ visibleNodeIDs()

QStringList qMRMLSortFilterProxyModel::visibleNodeIDs ( ) const

Return the list of nodes to show.

See also
visibleNodeIDs, setVisibleNodeIDs()

Member Data Documentation

◆ d_ptr

QScopedPointer<qMRMLSortFilterProxyModelPrivate> qMRMLSortFilterProxyModel::d_ptr
protected

Definition at line 273 of file qMRMLSortFilterProxyModel.h.


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