Slicer
5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
Combobox that automatically displays all the nodes of the scene that match filtering criteria. More...
#include <Libs/MRML/Widgets/qMRMLNodeComboBox.h>
Public Types | |
typedef QWidget | Superclass |
Properties | |
bool | addEnabled |
QString | baseName |
QString | currentNodeId |
QString | currentNodeID |
bool | editEnabled |
QStringList | hideChildNodeTypes |
QString | interactionNodeSingletonTag |
QStringList | nodeTypes |
QString | noneDisplay |
bool | noneEnabled |
bool | removeEnabled |
bool | renameEnabled |
bool | selectNodeUponCreation |
bool | showChildNodeTypes |
bool | showHidden |
QComboBox::SizeAdjustPolicy | sizeAdjustPolicy |
Public Slots | |
virtual vtkMRMLNode * | addNode (QString nodeType) |
Creates a node of the same type as in the "node types" property. More... | |
virtual vtkMRMLNode * | addNode () |
Creates a node of the same type as the first in the "node types" property. More... | |
virtual void | editCurrentNode () |
Edits the currently selected node. More... | |
virtual void | removeCurrentNode () |
virtual void | renameCurrentNode () |
void | setCurrentNode (vtkMRMLNode *node) |
Select the node to be current. More... | |
void | setCurrentNode (const QString &nodeID) |
void | setCurrentNodeID (const QString &nodeID) |
void | setCurrentNodeIndex (int index) |
virtual void | setMRMLScene (vtkMRMLScene *scene) |
Signals | |
void | currentNodeChanged (vtkMRMLNode *node) |
void | currentNodeChanged (bool validNode) |
void | currentNodeIDChanged (const QString &id) |
void | currentNodeRenamed (const QString &newName) |
Signal emitted when the current node is renamed. More... | |
void | nodeAboutToBeEdited (vtkMRMLNode *node) |
Signal emitted when edit node menu action is selected. More... | |
void | nodeAboutToBeRemoved (vtkMRMLNode *node) |
void | nodeActivated (vtkMRMLNode *node) |
void | nodeAdded (vtkMRMLNode *node) |
void | nodeAddedByUser (vtkMRMLNode *node) |
Signal emitted when node is added by the user. More... | |
Public Member Functions | |
Q_INVOKABLE void | addAttribute (const QString &nodeType, const QString &attributeName, const QVariant &attributeValue=QVariant()) |
bool | addEnabled () const |
virtual Q_INVOKABLE void | addMenuAction (QAction *newAction) |
QString | baseName (const QString &nodeType="") const |
Q_INVOKABLE vtkMRMLNode * | currentNode () const |
Return the currently selected node. 0 if no node is selected. More... | |
QString | currentNodeID () const |
Q_INVOKABLE QString | currentNodeId () const |
bool | editEnabled () const |
QStringList | hideChildNodeTypes () const |
virtual QString | interactionNodeSingletonTag () const |
QAbstractItemModel * | model () const |
Q_INVOKABLE vtkMRMLScene * | mrmlScene () const |
Q_INVOKABLE int | nodeCount () const |
qMRMLNodeFactory * | nodeFactory () const |
Q_INVOKABLE vtkMRMLNode * | nodeFromIndex (int index) const |
QList< vtkMRMLNode * > | nodes () const |
Return a list of all the nodes that are displayed in the combo box. More... | |
Q_INVOKABLE QString | nodeTypeLabel (const QString &nodeType) const |
QStringList | nodeTypes () const |
QString | noneDisplay () const |
bool | noneEnabled () const |
qMRMLNodeComboBox (QWidget *parent=nullptr) | |
Q_INVOKABLE void | removeAttribute (const QString &nodeType, const QString &attributeName) |
bool | removeEnabled () const |
bool | renameEnabled () const |
Allow the user to rename the node. More... | |
qMRMLSceneModel * | sceneModel () const |
bool | selectNodeUponCreation () const |
void | setAddEnabled (bool enable) |
void | setBaseName (const QString &baseName, const QString &nodeType="") |
void | setEditEnabled (bool enable) |
void | setHideChildNodeTypes (const QStringList &nodeTypes) |
virtual void | setInteractionNodeSingletonTag (const QString &tag) |
Q_INVOKABLE void | setNodeTypeLabel (const QString &label, const QString &nodeType) |
void | setNodeTypes (const QStringList &nodeTypes) |
void | setNoneDisplay (const QString &displayName) |
void | setNoneEnabled (bool enable) |
void | setRemoveEnabled (bool enable) |
void | setRenameEnabled (bool enable) |
void | setSelectNodeUponCreation (bool value) |
void | setShowChildNodeTypes (bool show) |
void | setShowHidden (bool) |
void | setSizeAdjustPolicy (QComboBox::SizeAdjustPolicy policy) |
bool | showChildNodeTypes () const |
bool | showHidden () const |
QComboBox::SizeAdjustPolicy | sizeAdjustPolicy () const |
Q_INVOKABLE qMRMLSortFilterProxyModel * | sortFilterProxyModel () const |
~qMRMLNodeComboBox () override | |
Protected Slots | |
void | activateExtraItem (const QModelIndex &index) |
void | emitCurrentNodeChanged () |
void | emitNodeActivated (int currentIndex) |
void | emitNodesAboutToBeRemoved (const QModelIndex &parent, int start, int end) |
void | emitNodesAdded (const QModelIndex &parent, int start, int end) |
void | refreshIfCurrentNodeHidden () |
Protected Member Functions | |
void | changeEvent (QEvent *event) override |
QComboBox * | comboBox () const |
qMRMLNodeComboBox (QAbstractItemModel *model, QWidget *parent=nullptr) | |
qMRMLNodeComboBox will not take ownership on the model. More... | |
qMRMLNodeComboBox (qMRMLNodeComboBoxPrivate *pimpl, QWidget *parent=nullptr) | |
QAbstractItemModel * | rootModel () const |
void | setComboBox (QComboBox *comboBox) |
Protected Attributes | |
QScopedPointer< qMRMLNodeComboBoxPrivate > | d_ptr |
Combobox that automatically displays all the nodes of the scene that match filtering criteria.
qMRMLNodeComboBox observes a MRML scene and gets automatically populated with nodes of the scene that are of type nodeTypes, and that are not hidden from editor (see vtkMRMLNode::GetHideFromEditor()) except if showHidden is true. Sometimes, having no current node can be a valid choice, noneEnabled allows the user to select or not "None" as the current node. qMRMLNodeComboBox is disabled (grayed out) until a valid scene (not null) is provided via setMRMLScene(). Setting the scene can be done from the designer by connecting a mrmlSceneChanged(vtkMRMLScene*) signal with the slot qMRMLNodeComboBox::setMRMLScene(vtkMRMLScene*). In addition to the populated nodes, qMRMLNodeComboBox contains menu items to add, delete, edit or rename the currently selected node. Each item can be hidden.
Definition at line 55 of file qMRMLNodeComboBox.h.
typedef QWidget qMRMLNodeComboBox::Superclass |
Definition at line 96 of file qMRMLNodeComboBox.h.
|
readwrite |
Definition at line 74 of file qMRMLNodeComboBox.h.
|
readwrite |
Definition at line 66 of file qMRMLNodeComboBox.h.
|
readwrite |
Definition at line 60 of file qMRMLNodeComboBox.h.
|
readwrite |
Definition at line 59 of file qMRMLNodeComboBox.h.
|
readwrite |
Definition at line 76 of file qMRMLNodeComboBox.h.
|
readwrite |
Definition at line 64 of file qMRMLNodeComboBox.h.
|
readwrite |
Node editing is requested via an interaction node in the scene. This singleton tag identifies which interaction node should be used. In most cases, it is not necessary to change the default value. If the value is set to empty then only nodeAboutToBeEdited signal is invoked but node editing is not requested via interaction node.
Definition at line 85 of file qMRMLNodeComboBox.h.
|
readwrite |
Definition at line 61 of file qMRMLNodeComboBox.h.
|
readwrite |
This property controls the name that is displayed for the None item. "None" by default.
Definition at line 91 of file qMRMLNodeComboBox.h.
|
readwrite |
This property controls whether an additional item is added into the menu list, such item allows the user to select none of the nodes in the combobox list. By default, the display of the item is "None" but it can be changed with noneDisplay.
Definition at line 73 of file qMRMLNodeComboBox.h.
|
readwrite |
Definition at line 75 of file qMRMLNodeComboBox.h.
|
readwrite |
Definition at line 77 of file qMRMLNodeComboBox.h.
|
readwrite |
Definition at line 87 of file qMRMLNodeComboBox.h.
|
readwrite |
Definition at line 63 of file qMRMLNodeComboBox.h.
|
readwrite |
Definition at line 62 of file qMRMLNodeComboBox.h.
|
readwrite |
Definition at line 93 of file qMRMLNodeComboBox.h.
|
explicit |
Construct an empty qMRMLNodeComboBox with a null scene, no nodeType, where the hidden nodes are not forced on display.
|
override |
|
protected |
qMRMLNodeComboBox will not take ownership on the model.
|
protected |
|
protectedslot |
Q_INVOKABLE void qMRMLNodeComboBox::addAttribute | ( | const QString & | nodeType, |
const QString & | attributeName, | ||
const QVariant & | attributeValue = QVariant() |
||
) |
Add node type attribute that filter the nodes to display. For example, colormap categories are defined with the "Category" attribute. In the following, the combobox only display Discrete colormap nodes.
bool qMRMLNodeComboBox::addEnabled | ( | ) | const |
Allow the user to create a new node. An "Add node" item is added into the menu list.
|
virtual |
Allow addition of menu actions in addition to the default actions that can be flagged on or off via setAddEnabled() etc. New actions are saved to the UserMenuActions list, and are added to the extra items list in updateActionItems(bool resetRootIndex) and set as post items on the scene model. The new actions are checked for and triggered in activateExtraItem(const QModelIndex& index) Checks for action text duplicates and doesn't add them. Also checks for action text that will be hidden by the default action texts and doesn't add it.
|
virtualslot |
Creates a node of the same type as in the "node types" property.
Its name is generated using basename.
|
virtualslot |
Creates a node of the same type as the first in the "node types" property.
Its name is generated using basename.
QString qMRMLNodeComboBox::baseName | ( | const QString & | nodeType = "" | ) | const |
|
overrideprotected |
|
protected |
Exposed internal combobox to tweak its behavior such as changing the QComboBox view or item delegate.
Q_INVOKABLE vtkMRMLNode* qMRMLNodeComboBox::currentNode | ( | ) | const |
Return the currently selected node. 0 if no node is selected.
|
signal |
This signal is sent anytime the current node is changed. nullptr if no node is current or the current item is "None".
|
signal |
Signal emitted just after currentNodeChanged(vtkMRMLNode*) is. validNode set to True when the current node is changed. Set to False when the list is empty. Useful to enable/disable/show/hide other widgets depending on the validity of the current node.
QString qMRMLNodeComboBox::currentNodeID | ( | ) | const |
Return the currently selected node id . "" if no node is selected Utility function that is based on currentNode
Q_INVOKABLE QString qMRMLNodeComboBox::currentNodeId | ( | ) | const |
|
signal |
This signal is sent anytime the current node is changed. "" if no node is current or the current item is "None".
|
signal |
Signal emitted when the current node is renamed.
TBD: void nodeRemoved(vtkMRMLNode*);
|
virtualslot |
Edits the currently selected node.
bool qMRMLNodeComboBox::editEnabled | ( | ) | const |
TODO Allow the user to modify the properties of the currently selected.
|
protectedslot |
|
protectedslot |
|
protectedslot |
|
protectedslot |
|
inline |
|
virtual |
QAbstractItemModel* qMRMLNodeComboBox::model | ( | ) | const |
Internal model associated to the combobox. It is usually not the scene model but the sort filter proxy model.
Q_INVOKABLE vtkMRMLScene* qMRMLNodeComboBox::mrmlScene | ( | ) | const |
Get MRML scene that has been set by setMRMLScene(), there is no scene by default (0).
|
signal |
Signal emitted when edit node menu action is selected.
|
signal |
Signal emitted when node is about to be removed from the comboBox. Only nodes with valid type emit the signal
|
signal |
Advanced function. This signal is sent when the user chooses a node in the combobox. The item's node is passed. Note that this signal is sent even when the choice is not changed. If you need to know when the choice actually changes, use signal currentNodeChanged().
|
signal |
TBD void nodeAboutToBeAdded(vtkMRMLNode*); Signal emitted when node is added to the comboBox Only nodes with valid type emit the signal
|
signal |
Signal emitted when node is added by the user.
Q_INVOKABLE int qMRMLNodeComboBox::nodeCount | ( | ) | const |
return the number of nodes. it can be different from count() as count includes the "AddNode", "Remove Node"... items
qMRMLNodeFactory* qMRMLNodeComboBox::nodeFactory | ( | ) | const |
Return the node factory used to create nodes when "Add Node" is selected (property AddEnabled should be true). A typical use would be to connect the node factory signal nodeInitialized(vtkMRMLNode*) with your own initialization routine slot: connect(nodeComboBox->nodeFactory(), SIGNAL(nodeInitialized(vtkMRMLNode*)), this, SLOT(initializeNode(vtkMRMLNode*)));
Q_INVOKABLE vtkMRMLNode* qMRMLNodeComboBox::nodeFromIndex | ( | int | index | ) | const |
return the vtkMRMLNode* at the corresponding index. 0 if the index is invalid
QList<vtkMRMLNode*> qMRMLNodeComboBox::nodes | ( | ) | const |
Return a list of all the nodes that are displayed in the combo box.
Q_INVOKABLE QString qMRMLNodeComboBox::nodeTypeLabel | ( | const QString & | nodeType | ) | const |
QStringList qMRMLNodeComboBox::nodeTypes | ( | ) | const |
Set/Get node types to display in the list NodeTypes are the class names, i.e. vtkMRMLViewNode, vtkMRMLTransformNode
QString qMRMLNodeComboBox::noneDisplay | ( | ) | const |
Return the name of the "none" item
bool qMRMLNodeComboBox::noneEnabled | ( | ) | const |
Return true if the "none" is in the comboBox list, false otherwise.
|
protectedslot |
Q_INVOKABLE void qMRMLNodeComboBox::removeAttribute | ( | const QString & | nodeType, |
const QString & | attributeName | ||
) |
Remove node type attribute filtering the displayed nodes
|
virtualslot |
Removes the current node from the scene. The node reference count gets decremented which might lead to deletion (if it reaches 0).
bool qMRMLNodeComboBox::removeEnabled | ( | ) | const |
Allow the user to delete the currently selected node. A "Remove node" item is added to the menu list.
|
virtualslot |
Renames the currently selected node. It shows an input dialog box with the current name of the node
bool qMRMLNodeComboBox::renameEnabled | ( | ) | const |
Allow the user to rename the node.
|
protected |
qMRMLSceneModel* qMRMLNodeComboBox::sceneModel | ( | ) | const |
Retrieve the scene model internally used. The scene model is usually not used directly, but a sortFilterProxyModel is plugged in.
bool qMRMLNodeComboBox::selectNodeUponCreation | ( | ) | const |
if true, when the user create a node using "Add node", the node will be automatically selected. It doesn't apply if the node is programmatically added (when the combobox is populated by the scene).
void qMRMLNodeComboBox::setAddEnabled | ( | bool | enable | ) |
void qMRMLNodeComboBox::setBaseName | ( | const QString & | baseName, |
const QString & | nodeType = "" |
||
) |
BaseName is the name used to generate a node name for all the new created nodes. If nodeType is not specified for setBaseName() then base name is set for all already defined node types. If nodeType is not specified for baseName() then base name of the first node type is returned.
|
protected |
|
slot |
Select the node to be current.
|
slot |
|
slot |
Select the node to be current. If nodeID is invalid (or can't be found in the scene), the current node becomes 0.
|
slot |
Select the current node by index. The index refers to the order of the nodes into the list. If index is 0, the first node will be selected (even if "NoneEnabled" is true).
void qMRMLNodeComboBox::setEditEnabled | ( | bool | enable | ) |
|
inline |
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)
Definition at line 427 of file qMRMLNodeComboBox.h.
|
virtual |
|
virtualslot |
Set the scene the combobox listens to. The scene is observed and when new nodes are added to the scene, the menu list is populated.
Reimplemented in qMRMLColorTableComboBox.
Q_INVOKABLE void qMRMLNodeComboBox::setNodeTypeLabel | ( | const QString & | label, |
const QString & | nodeType | ||
) |
NodeTypeLabel is the name displayed to the user as node type. By default the node's tag is used. Configuration is useful for cases when a more specific type name is preferred (e.g., instead of the generic "Create new SubjectHierarchy" option, a module can set up the widget to show "Create new Measurements"). If label is set to empty then the default label is used.
void qMRMLNodeComboBox::setNodeTypes | ( | const QStringList & | nodeTypes | ) |
void qMRMLNodeComboBox::setNoneDisplay | ( | const QString & | displayName | ) |
Set the name of the "none" item.
void qMRMLNodeComboBox::setNoneEnabled | ( | bool | enable | ) |
Set whether the "none" item should be in the comboBox list or not.
void qMRMLNodeComboBox::setRemoveEnabled | ( | bool | enable | ) |
void qMRMLNodeComboBox::setRenameEnabled | ( | bool | enable | ) |
void qMRMLNodeComboBox::setSelectNodeUponCreation | ( | bool | value | ) |
|
inline |
This property controls whether subclasses of nodeType are hidden or not. If false, only the nodes of 'final' type is nodeType are displayed, if true, all the nodes deriving from nodeType are visible except for the ones of type hideChildNodeTypes. true by default.
Definition at line 415 of file qMRMLNodeComboBox.h.
|
inline |
If a vtkMRMLNode has the property HideFromEditors set to true, bypass the property and show the node anyway.
Definition at line 403 of file qMRMLNodeComboBox.h.
void qMRMLNodeComboBox::setSizeAdjustPolicy | ( | QComboBox::SizeAdjustPolicy | policy | ) |
|
inline |
|
inline |
QComboBox::SizeAdjustPolicy qMRMLNodeComboBox::sizeAdjustPolicy | ( | ) | const |
Q_INVOKABLE qMRMLSortFilterProxyModel* qMRMLNodeComboBox::sortFilterProxyModel | ( | ) | const |
Retrieve the sortFilterProxyModel used to filter/sort the nodes.
|
protected |
Definition at line 395 of file qMRMLNodeComboBox.h.