Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkColoredNodeDescriptor Class Referencefinal

Node descriptor that recolors an SVG icon to match the DataNode color. More...

#include <QmitkColoredNodeDescriptor.h>

Inheritance diagram for QmitkColoredNodeDescriptor:
Collaboration diagram for QmitkColoredNodeDescriptor:

Public Member Functions

 QmitkColoredNodeDescriptor (const QString &className, const QString &pathToIcon, mitk::NodePredicateBase *predicate, QObject *parent=nullptr)
 Constructs a colored node descriptor. More...
 
 ~QmitkColoredNodeDescriptor () override
 
QIcon GetIcon (const mitk::DataNode *node) const override
 Returns the icon with the magic color replaced by the node's color. More...
 
- Public Member Functions inherited from QmitkNodeDescriptor
 QmitkNodeDescriptor (const QString &_ClassName, const QString &_PathToIcon, mitk::NodePredicateBase *_Predicate, QObject *parent)
 
 QmitkNodeDescriptor (const QString &_ClassName, const QIcon &_Icon, mitk::NodePredicateBase *_Predicate, QObject *parent)
 
 ~QmitkNodeDescriptor () override
 
virtual QString GetNameOfClass () const
 
virtual QAction * GetSeparator () const
 
virtual bool CheckNode (const mitk::DataNode *node) const
 
virtual void AddAction (QAction *action, bool isBatchAction=true)
 
virtual void RemoveAction (QAction *_Action)
 
virtual QList< QAction * > GetActions () const
 
virtual QList< QAction * > GetBatchActions () const
 

Additional Inherited Members

- Public Slots inherited from QmitkNodeDescriptor
void ActionDestroyed (QObject *obj=nullptr)
 Called when an action was destroyed. More...
 
- Protected Attributes inherited from QmitkNodeDescriptor
QString m_ClassName
 
QIcon m_Icon
 
mitk::NodePredicateBase::Pointer m_Predicate
 
QList< QAction * > m_Actions
 
QList< QAction * > m_BatchActions
 
QAction * m_Separator
 

Detailed Description

Node descriptor that recolors an SVG icon to match the DataNode color.

This class extends QmitkNodeDescriptor by replacing the magic color #00ff00 in the provided SVG icon template with the actual color of the mitk::DataNode. Recolored icons are cached internally so that each unique color is only rendered once.

See also
QmitkNodeDescriptor
QmitkNodeDescriptorManager

Definition at line 30 of file QmitkColoredNodeDescriptor.h.

Constructor & Destructor Documentation

◆ QmitkColoredNodeDescriptor()

QmitkColoredNodeDescriptor::QmitkColoredNodeDescriptor ( const QString &  className,
const QString &  pathToIcon,
mitk::NodePredicateBase *  predicate,
QObject *  parent = nullptr 
)
explicit

Constructs a colored node descriptor.

Parameters
[in]classNameThe class name this descriptor is associated with.
[in]pathToIconPath to an SVG file containing the magic color #00ff00.
[in]predicateNode predicate that determines which nodes this descriptor matches.
[in]parentOptional parent QObject.

◆ ~QmitkColoredNodeDescriptor()

QmitkColoredNodeDescriptor::~QmitkColoredNodeDescriptor ( )
override

Member Function Documentation

◆ GetIcon()

QIcon QmitkColoredNodeDescriptor::GetIcon ( const mitk::DataNode *  node) const
overridevirtual

Returns the icon with the magic color replaced by the node's color.

The node's RGB color property is read and converted to a hex color code. The resulting icon is cached for future requests with the same color.

Parameters
[in]nodeThe data node whose color is used for the icon.
Returns
The recolored QIcon, or an empty icon if node is nullptr.

Reimplemented from QmitkNodeDescriptor.


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