#include <QmitkNodeDescriptor.h>
Public Slots | |
void | ActionDestroyed (QObject *obj=0) |
Called when an action was destroyed. | |
Public Member Functions | |
QmitkNodeDescriptor (const QString &_ClassName, const QString &_PathToIcon, mitk::NodePredicateBase *_Predicate, QObject *parent) | |
virtual | ~QmitkNodeDescriptor () |
virtual QString | GetClassName () const |
virtual QIcon | GetIcon () 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 |
Protected Attributes | |
QString | m_ClassName |
QString | m_PathToIcon |
mitk::NodePredicateBase::Pointer | m_Predicate |
QList< QAction * > | m_Actions |
QList< QAction * > | m_BatchActions |
QAction * | m_Separator |
Definition at line 41 of file QmitkNodeDescriptor.h.
QmitkNodeDescriptor::QmitkNodeDescriptor | ( | const QString & | _ClassName, |
const QString & | _PathToIcon, | ||
mitk::NodePredicateBase * | _Predicate, | ||
QObject * | parent | ||
) |
Creates a new QmitkNodeQmitkNodeDescriptor
Definition at line 25 of file QmitkNodeDescriptor.cpp.
References m_Separator.
: QObject(parent) , m_ClassName(_ClassName) , m_PathToIcon(_PathToIcon) , m_Predicate(_Predicate) , m_Separator(new QAction(this)) { m_Separator->setSeparator(true); }
QmitkNodeDescriptor::~QmitkNodeDescriptor | ( | ) | [virtual] |
Deletes all actions
Definition at line 92 of file QmitkNodeDescriptor.cpp.
{
// all children are destroyed here by Qt
}
void QmitkNodeDescriptor::ActionDestroyed | ( | QObject * | obj = 0 ) |
[slot] |
Called when an action was destroyed.
Definition at line 107 of file QmitkNodeDescriptor.cpp.
References RemoveAction().
Referenced by AddAction(), and RemoveAction().
{ this->RemoveAction( qobject_cast<QAction*>(obj) ); }
void QmitkNodeDescriptor::AddAction | ( | QAction * | action, |
bool | isBatchAction = true |
||
) | [virtual] |
Create and return an action with this descriptor as owner
Definition at line 58 of file QmitkNodeDescriptor.cpp.
References ActionDestroyed(), m_Actions, and m_BatchActions.
Referenced by QmitkDataManagerView::CreateQtPartControl(), and QmitkSegmentationPostProcessing::QmitkSegmentationPostProcessing().
{ if(!action) return; if(isBatchAction) m_BatchActions.push_back(action); else m_Actions.push_back(action); QObject::connect( action, SIGNAL( destroyed(QObject *) ) , this, SLOT( ActionDestroyed(QObject *) ) ); }
bool QmitkNodeDescriptor::CheckNode | ( | const mitk::DataNode * | node ) | const [virtual] |
Check if this class describes the given node
Definition at line 51 of file QmitkNodeDescriptor.cpp.
References m_Predicate.
{ if(m_Predicate.IsNotNull()) return m_Predicate->CheckNode(node); return false; }
QList< QAction * > QmitkNodeDescriptor::GetActions | ( | ) | const [virtual] |
Get all actions associated with this class of nodes
Definition at line 46 of file QmitkNodeDescriptor.cpp.
References m_Actions.
Referenced by QmitkNodeDescriptorManager::GetActions().
{ return m_Actions; }
QList< QAction * > QmitkNodeDescriptor::GetBatchActions | ( | ) | const [virtual] |
Get all actions for this descriptor class that can be executed on multiple nodes (no priot knowledge abpout the node is required)
Definition at line 102 of file QmitkNodeDescriptor.cpp.
References m_BatchActions.
Referenced by QmitkNodeDescriptorManager::GetActions().
{ return m_BatchActions; }
QString QmitkNodeDescriptor::GetClassName | ( | ) | const [virtual] |
Returns a name for this class of DataNodes (e.g. "Image", "Image Mask", etc.)
Definition at line 36 of file QmitkNodeDescriptor.cpp.
References m_ClassName.
Referenced by QmitkDataStorageTableModel::data().
{ return m_ClassName; }
QIcon QmitkNodeDescriptor::GetIcon | ( | ) | const [virtual] |
Returns an Icon for this class of DataNodes
Definition at line 41 of file QmitkNodeDescriptor.cpp.
References m_PathToIcon.
Referenced by QmitkPlanarFiguresTableModel::data(), QmitkDataStorageTreeModel::data(), and QmitkDataStorageTableModel::data().
{ return QIcon(m_PathToIcon); }
QAction * QmitkNodeDescriptor::GetSeparator | ( | ) | const [virtual] |
Returns an Icon for this class of DataNodes
Definition at line 97 of file QmitkNodeDescriptor.cpp.
References m_Separator.
Referenced by QmitkNodeDescriptorManager::GetActions().
{ return m_Separator; }
void QmitkNodeDescriptor::RemoveAction | ( | QAction * | _Action ) | [virtual] |
Remove and delete (!) an action
Definition at line 71 of file QmitkNodeDescriptor.cpp.
References ActionDestroyed(), m_Actions, and m_BatchActions.
Referenced by ActionDestroyed(), and QmitkSegmentationPostProcessing::~QmitkSegmentationPostProcessing().
{ int index = m_Actions.indexOf(_Action); int indexOfWidgetAction = m_BatchActions.indexOf(_Action); if(index != -1) { m_Actions.removeAt(index); } else if(indexOfWidgetAction != -1) { m_BatchActions.removeAt(indexOfWidgetAction); } if( _Action != 0) { QObject::disconnect( _Action, SIGNAL( destroyed(QObject *) ) , this, SLOT( ActionDestroyed(QObject *) ) ); } }
QList<QAction*> QmitkNodeDescriptor::m_Actions [protected] |
Definition at line 95 of file QmitkNodeDescriptor.h.
Referenced by AddAction(), GetActions(), and RemoveAction().
QList<QAction*> QmitkNodeDescriptor::m_BatchActions [protected] |
Definition at line 96 of file QmitkNodeDescriptor.h.
Referenced by AddAction(), GetBatchActions(), and RemoveAction().
QString QmitkNodeDescriptor::m_ClassName [protected] |
Definition at line 92 of file QmitkNodeDescriptor.h.
Referenced by GetClassName().
QString QmitkNodeDescriptor::m_PathToIcon [protected] |
Definition at line 93 of file QmitkNodeDescriptor.h.
Referenced by GetIcon().
Definition at line 94 of file QmitkNodeDescriptor.h.
Referenced by CheckNode().
QAction* QmitkNodeDescriptor::m_Separator [protected] |
Definition at line 97 of file QmitkNodeDescriptor.h.
Referenced by GetSeparator(), and QmitkNodeDescriptor().