21 #ifndef __qMRMLNodeComboBox_h 22 #define __qMRMLNodeComboBox_h 29 #include "qMRMLWidgetsExport.h" 31 class qMRMLNodeComboBoxPrivate;
59 Q_PROPERTY(QString currentNodeID READ currentNodeID WRITE setCurrentNodeID NOTIFY currentNodeIDChanged DESIGNABLE
false)
60 Q_PROPERTY(QString currentNodeId READ currentNodeId WRITE setCurrentNode DESIGNABLE false)
61 Q_PROPERTY(QStringList nodeTypes READ nodeTypes WRITE setNodeTypes)
62 Q_PROPERTY(
bool showHidden READ showHidden WRITE setShowHidden)
63 Q_PROPERTY(
bool showChildNodeTypes READ showChildNodeTypes WRITE setShowChildNodeTypes)
64 Q_PROPERTY(QStringList hideChildNodeTypes READ hideChildNodeTypes WRITE setHideChildNodeTypes)
66 Q_PROPERTY(QString baseName READ baseName WRITE setBaseName)
73 Q_PROPERTY(
bool noneEnabled READ noneEnabled WRITE setNoneEnabled)
74 Q_PROPERTY(
bool addEnabled READ addEnabled WRITE setAddEnabled)
75 Q_PROPERTY(
bool removeEnabled READ removeEnabled WRITE setRemoveEnabled)
76 Q_PROPERTY(
bool editEnabled READ editEnabled WRITE setEditEnabled)
77 Q_PROPERTY(
bool renameEnabled READ renameEnabled WRITE setRenameEnabled)
79 Q_PROPERTY(
bool selectNodeUponCreation READ selectNodeUponCreation WRITE setSelectNodeUponCreation)
83 Q_PROPERTY(QString noneDisplay READ noneDisplay WRITE setNoneDisplay)
85 Q_PROPERTY(QComboBox::SizeAdjustPolicy sizeAdjustPolicy READ sizeAdjustPolicy WRITE setSizeAdjustPolicy)
103 QStringList nodeTypes()const;
104 void setNodeTypes(const QStringList& nodeTypes);
108 inline
void setShowHidden(
bool);
109 inline
bool showHidden()const;
117 inline
void setShowChildNodeTypes(
bool show);
118 inline
bool showChildNodeTypes()const;
123 inline
void setHideChildNodeTypes(const QStringList& nodeTypes);
124 inline QStringList hideChildNodeTypes()const;
136 Q_INVOKABLE
void addAttribute(const QString& nodeType,
137 const QString& attributeName,
138 const QVariant& attributeValue = QVariant());
141 Q_INVOKABLE
void removeAttribute(const QString& nodeType,
142 const QString& attributeName);
148 void setBaseName(const QString& baseName, const QString& nodeType = "");
149 QString baseName(const QString& nodeType = "")const;
155 Q_INVOKABLE
void setNodeTypeLabel(const QString& label, const QString& nodeType);
156 Q_INVOKABLE QString nodeTypeLabel(const QString& nodeType)const;
160 int nodeCount()const;
172 QString currentNodeID()const;
176 Q_INVOKABLE QString currentNodeId()const;
181 bool selectNodeUponCreation()const;
182 void setSelectNodeUponCreation(
bool value);
186 bool noneEnabled()const;
189 void setNoneEnabled(
bool enable);
193 bool addEnabled()const;
194 void setAddEnabled(
bool enable);
198 bool removeEnabled()const;
199 void setRemoveEnabled(
bool enable);
203 bool editEnabled()const;
204 void setEditEnabled(
bool enable);
207 bool renameEnabled()const;
208 void setRenameEnabled(
bool enable);
212 QString noneDisplay()const;
216 void setNoneDisplay(const QString& displayName);
224 QAbstractItemModel* model()const;
247 QComboBox::SizeAdjustPolicy sizeAdjustPolicy()const;
248 void setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy policy);
259 Q_INVOKABLE virtual
void addMenuAction(QAction *newAction);
271 void setCurrentNode(const QString& nodeID);
275 void setCurrentNodeID(const QString& nodeID);
281 void setCurrentNodeIndex(
int index);
304 virtual
void removeCurrentNode();
307 virtual
void editCurrentNode();
312 virtual
void renameCurrentNode();
321 void currentNodeIDChanged(const QString&
id);
336 void currentNodeChanged(
bool validNode);
356 void currentNodeRenamed(const QString& newName);
363 qMRMLNodeComboBox(QAbstractItemModel* model, QWidget* parent = 0);
364 qMRMLNodeComboBox(qMRMLNodeComboBoxPrivate* pimpl, QWidget* parent = 0);
365 QAbstractItemModel* rootModel()const;
367 void setComboBox(QComboBox* comboBox);
371 QComboBox* comboBox()const;
373 virtual
void changeEvent(QEvent* event);
376 void activateExtraItem(const QModelIndex& index);
377 void emitCurrentNodeChanged();
378 void emitNodeActivated(
int currentIndex);
379 void emitNodesAdded(const QModelIndex & parent,
int start,
int end);
380 void emitNodesAboutToBeRemoved(const QModelIndex & parent,
int start,
int end);
381 void refreshIfCurrentNodeHidden();
384 QScopedPointer<qMRMLNodeComboBoxPrivate> d_ptr;
387 Q_DECLARE_PRIVATE(qMRMLNodeComboBox);
388 Q_DISABLE_COPY(qMRMLNodeComboBox);
392 void qMRMLNodeComboBox::setShowHidden(
bool enable)
394 this->sortFilterProxyModel()->setShowHidden(enable);
400 return this->sortFilterProxyModel()->showHidden();
406 this->sortFilterProxyModel()->setShowChildNodeTypes(show);
412 return this->sortFilterProxyModel()->showChildNodeTypes();
418 this->sortFilterProxyModel()->setHideChildNodeTypes(_nodeTypes);
424 return this->sortFilterProxyModel()->hideChildNodeTypes();
void setHideChildNodeTypes(const QStringList &nodeTypes)
QStringList hideChildNodeTypes() const
A set of MRML Nodes that supports serialization and undo/redo.
bool showChildNodeTypes() const
void setShowChildNodeTypes(bool show)
Combobox that automatically displays all the nodes of the scene that match filtering criteria...
Abstract Superclass for all specific types of MRML nodes.