Slicer
4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
#include <Libs/MRML/Widgets/qMRMLNodeFactory.h>
Public Types | |
typedef QHash< QString, QString > | AttributeType |
Convenient typedef. More... | |
typedef QObject | Superclass |
Constructors. More... | |
Public Slots | |
void | setMRMLScene (vtkMRMLScene *mrmlScene) |
Set MRML scene More... | |
Signals | |
void | nodeAdded (vtkMRMLNode *node) |
void | nodeInitialized (vtkMRMLNode *node) |
void | nodeInstantiated (vtkMRMLNode *node) |
Public Member Functions | |
Q_INVOKABLE void | addAttribute (const QString &attributeName, const QString &attributeValue) |
Q_INVOKABLE QString | attribute (const QString &attributeName) const |
Q_INVOKABLE QString | baseName (const QString &className) const |
Q_INVOKABLE vtkMRMLNode * | createNode (const QString &className) |
vtkMRMLScene * | mrmlScene () const |
qMRMLNodeFactory (QObject *parent=nullptr) | |
Q_INVOKABLE void | removeAttribute (const QString &attributeName) |
Q_INVOKABLE void | setBaseName (const QString &className, const QString &baseName) |
Base name used to generate a name for create node. More... | |
~qMRMLNodeFactory () override | |
Static Public Member Functions | |
static vtkMRMLNode * | createNode (vtkMRMLScene *scene, const QString &className, const AttributeType &attributes=AttributeType()) |
Convenient method allowing to create a new node and add it to the scene More... | |
Protected Attributes | |
QScopedPointer< qMRMLNodeFactoryPrivate > | d_ptr |
Node factory that can be used by qMRML widgets to easily create nodes If you want more control over the node creation, you can add attributes, specify a base node name or connect to signals to customize the node
Definition at line 40 of file qMRMLNodeFactory.h.
typedef QHash<QString,QString> qMRMLNodeFactory::AttributeType |
Convenient typedef.
Definition at line 46 of file qMRMLNodeFactory.h.
typedef QObject qMRMLNodeFactory::Superclass |
Constructors.
Definition at line 49 of file qMRMLNodeFactory.h.
|
explicit |
|
override |
Q_INVOKABLE void qMRMLNodeFactory::addAttribute | ( | const QString & | attributeName, |
const QString & | attributeValue | ||
) |
Add attribute that will be passed to any new created node. TODO: Support attributes for more than 1 node class Note: If an attribute already exist, it's value will be overwritten.
Q_INVOKABLE QString qMRMLNodeFactory::attribute | ( | const QString & | attributeName | ) | const |
Q_INVOKABLE QString qMRMLNodeFactory::baseName | ( | const QString & | className | ) | const |
Q_INVOKABLE vtkMRMLNode* qMRMLNodeFactory::createNode | ( | const QString & | className | ) |
Create and add a node given its className to the scene associated with the factory. The function will fire the signals: nodeInstantiated(vtkMRMLNode*), nodeInitialized(vtkMRMLNode*), nodeAdded(vtkMRMLNode*) on that order. It allows the user to add custom steps by connecting slots to the emitted signals. No-op if the scene is 0 or if className is empty/null. However, if className is not empty but invalid (not an existing node), an assert throws an exception. Note: The attributes will be applied to the node before being added into the scene. The scene takes the ownership of the node and is responsible to delete it If the node is a singleton that already exists in the scene, the existing node is returned.
|
static |
Convenient method allowing to create a new node and add it to the scene
vtkMRMLScene* qMRMLNodeFactory::mrmlScene | ( | ) | const |
Get MRML scene. By default, there is no scene.
|
signal |
Fired at the end when the node is added into the scene. It is emitted even if the node has been added to the scene by a custom slot connected to nodeInitialized(vtkMRMLNode*)
|
signal |
Eventually fired by the function createNode You can add the node into the scene directly here. If no slot adds the node into the scene(node->GetScene() == 0), then the node factory takes care of adding the node into the scene (default behavior).
|
signal |
Fired right after the instantiation of the node (before any initialization) Connecting to the following signal allows a custom node creation
Q_INVOKABLE void qMRMLNodeFactory::removeAttribute | ( | const QString & | attributeName | ) |
Q_INVOKABLE void qMRMLNodeFactory::setBaseName | ( | const QString & | className, |
const QString & | baseName | ||
) |
Base name used to generate a name for create node.
|
slot |
Set MRML scene
|
protected |
Definition at line 114 of file qMRMLNodeFactory.h.