23 #ifndef __qMRMLSubjectHierarchyTreeView_h 24 #define __qMRMLSubjectHierarchyTreeView_h 30 #include <ctkVTKObject.h> 33 #include "qSlicerSubjectHierarchyModuleWidgetsExport.h" 35 class qMRMLSubjectHierarchyTreeViewPrivate;
53 Q_PROPERTY(
bool showRootItem READ showRootItem WRITE setShowRootItem)
57 Q_PROPERTY(
bool highlightReferencedItems READ highlightReferencedItems WRITE setHighlightReferencedItems)
59 Q_PROPERTY(
bool contextMenuEnabled READ contextMenuEnabled WRITE setContextMenuEnabled)
61 Q_PROPERTY(
bool editMenuActionVisible READ editMenuActionVisible WRITE setEditMenuActionVisible)
63 Q_PROPERTY(
bool selectRoleSubMenuVisible READ selectRoleSubMenuVisible WRITE setSelectRoleSubMenuVisible)
65 Q_PROPERTY(
bool multiSelection READ multiSelection WRITE setMultiSelection)
66 Q_PROPERTY(QStringList levelFilter READ levelFilter WRITE setLevelFilter)
67 Q_PROPERTY(QString nameFilter READ nameFilter WRITE setNameFilter)
68 Q_PROPERTY(QStringList nodeTypes READ nodeTypes WRITE setNodeTypes)
69 Q_PROPERTY(QStringList hideChildNodeTypes READ hideChildNodeTypes WRITE setHideChildNodeTypes)
70 Q_PROPERTY(
bool visibilityColumnVisible READ visibilityColumnVisible WRITE setVisibilityColumnVisible)
71 Q_PROPERTY(
bool idColumnVisible READ idColumnVisible WRITE setIdColumnVisible)
72 Q_PROPERTY(
bool colorColumnVisible READ colorColumnVisible WRITE setColorColumnVisible)
73 Q_PROPERTY(
bool transformColumnVisible READ transformColumnVisible WRITE setTransformColumnVisible)
74 Q_PROPERTY(
bool descriptionColumnVisible READ descriptionColumnVisible WRITE setDescriptionColumnVisible)
78 Q_PROPERTY(
bool noneEnabled READ noneEnabled WRITE setNoneEnabled)
82 Q_PROPERTY(QString noneDisplay READ noneDisplay WRITE setNoneDisplay)
85 Q_PROPERTY(QStringList includeItemAttributeNamesFilter READ includeItemAttributeNamesFilter WRITE setIncludeItemAttributeNamesFilter)
87 Q_PROPERTY(QStringList includeNodeAttributeNamesFilter READ includeNodeAttributeNamesFilter WRITE setIncludeNodeAttributeNamesFilter)
90 Q_PROPERTY(QStringList excludeItemAttributeNamesFilter READ excludeItemAttributeNamesFilter WRITE setExcludeItemAttributeNamesFilter)
93 Q_PROPERTY(QStringList excludeNodeAttributeNamesFilter READ excludeNodeAttributeNamesFilter WRITE setExcludeNodeAttributeNamesFilter)
97 Q_PROPERTY(QString attributeNameFilter READ attributeNameFilter WRITE setAttributeNameFilter)
102 Q_PROPERTY(QString attributeValueFilter READ attributeValueFilter WRITE setAttributeValueFilter)
114 Q_INVOKABLE vtkIdType currentItem()const;
116 QList<vtkIdType> currentItems();
119 Q_INVOKABLE
void currentItems(vtkIdList* selectedItems);
125 Q_INVOKABLE vtkIdType rootItem()const;
127 bool showRootItem()const;
130 bool multiSelection();
132 QStringList includeItemAttributeNamesFilter()const;
133 QStringList includeNodeAttributeNamesFilter()const;
134 QStringList excludeItemAttributeNamesFilter()const;
135 QStringList excludeNodeAttributeNamesFilter()const;
136 QString attributeValueFilter()const;
137 QString attributeNameFilter()const;
142 Q_INVOKABLE
void setAttributeFilter(const QString& attributeName, const QVariant& attributeValue=QVariant());
144 Q_INVOKABLE
void removeAttributeFilter();
152 Q_INVOKABLE
void addItemAttributeFilter(QString attributeName, QVariant attributeValue=QString(),
bool include=true);
154 Q_INVOKABLE
void removeItemAttributeFilter(QString attributeName, QVariant attributeValue,
bool include);
156 Q_INVOKABLE
void removeItemAttributeFilter(QString attributeName,
bool include);
165 Q_INVOKABLE
void addNodeAttributeFilter(QString attributeName, QVariant attributeValue=QString(),
bool include=true, QString className=QString());
167 Q_INVOKABLE
void removeNodeAttributeFilter(QString attributeName, QVariant attributeValue,
bool include, QString className);
169 Q_INVOKABLE
void removeNodeAttributeFilter(QString attributeName,
bool include);
173 void setLevelFilter(QStringList &levelFilter);
174 QStringList levelFilter()const;
177 void setNameFilter(QString &nameFilter);
178 QString nameFilter()const;
181 void setNodeTypes(const QStringList& types);
182 QStringList nodeTypes()const;
186 void setHideChildNodeTypes(const QStringList& types);
187 QStringList hideChildNodeTypes()const;
193 Q_INVOKABLE
int displayedItemCount()const;
195 bool highlightReferencedItems()const;
196 bool contextMenuEnabled()const;
197 bool editMenuActionVisible()const;
198 bool selectRoleSubMenuVisible()const;
199 bool noneEnabled()const;
200 QString noneDisplay()const;
203 void setVisibilityColumnVisible(
bool visible);
204 bool visibilityColumnVisible();
206 void setIdColumnVisible(
bool visible);
207 bool idColumnVisible();
209 void setColorColumnVisible(
bool visible);
210 bool colorColumnVisible();
212 void setTransformColumnVisible(
bool visible);
213 bool transformColumnVisible();
215 void setDescriptionColumnVisible(
bool visible);
216 bool descriptionColumnVisible();
223 virtual
void setCurrentItem(vtkIdType itemID);
225 virtual
void setCurrentItems(
QList<vtkIdType> items);
227 virtual
void setCurrentItems(vtkIdList* items);
232 virtual
void setRootItem(vtkIdType itemID);
234 void setShowRootItem(
bool show);
237 void renameCurrentItem();
239 void deleteSelectedItems();
241 void toggleVisibilityOfSelectedItems();
243 virtual
void editCurrentItem();
246 virtual
void expandItem(vtkIdType itemID);
248 virtual
void collapseItem(vtkIdType itemID);
251 virtual
void selectPluginForCurrentItem();
257 virtual
void updateSelectPluginActions();
260 virtual
void setMultiSelection(
bool multiSelectionOn);
265 void setPluginAllowlist(QStringList allowlist);
269 void setPluginBlocklist(QStringList blocklist);
272 void disablePlugin(QString plugin);
275 void setPluginWhitelist(QStringList allowlist)
277 qWarning(
"qMRMLSubjectHierarchyTreeView::setPluginWhitelist is deprecated. Use setPluginAllowlist instead.");
278 this->setPluginAllowlist(allowlist);
283 qWarning(
"qMRMLSubjectHierarchyTreeView::setPluginBlacklist is deprecated. Use setPluginBlocklist instead.");
284 this->setPluginBlocklist(blocklist);
290 bool showContextMenuHint(
bool visibility=
false);
292 void setHighlightReferencedItems(
bool highlightOn);
293 void setContextMenuEnabled(
bool enabled);
294 void setEditMenuActionVisible(
bool visible);
295 void setSelectRoleSubMenuVisible(
bool visible);
296 void setNoneEnabled(
bool enable);
297 void setNoneDisplay(
const QString& displayName);
300 void resetColumnSizesToDefault();
302 void setIncludeItemAttributeNamesFilter(QStringList filter);
303 void setIncludeNodeAttributeNamesFilter(QStringList filter);
304 void setExcludeItemAttributeNamesFilter(QStringList filter);
305 void setExcludeNodeAttributeNamesFilter(QStringList filter);
306 void setAttributeNameFilter(QString& filter);
307 void setAttributeValueFilter(QString& filter);
310 void currentItemChanged(vtkIdType);
312 void currentItemModified(vtkIdType);
315 virtual void onSelectionChanged(
const QItemSelection &selected,
const QItemSelection &deselected);
318 virtual void onItemExpanded(
const QModelIndex &expandedItemIndex);
320 virtual void onItemCollapsed(
const QModelIndex &collapsedItemIndex);
323 virtual void expandToDepthFromContextMenu();
327 virtual void updateRootItem();
330 virtual void onSubjectHierarchyItemModified(vtkObject *caller,
void *callData);
332 virtual void onSubjectHierarchyItemTransformModified(vtkObject *caller,
void *callData);
335 virtual void onMRMLSceneStartClose(vtkObject* sceneObject);
337 virtual void onMRMLSceneEndClose(vtkObject* sceneObject);
339 virtual void onMRMLSceneStartBatchProcess(vtkObject* sceneObject);
341 virtual void onMRMLSceneEndBatchProcess(vtkObject* sceneObject);
343 void onCustomContextMenu(
const QPoint& point);
345 virtual void onTransformActionSelected();
346 virtual void onTransformInteractionInViewToggled(
bool show);
347 virtual void onTransformEditProperties();
348 virtual void onCreateNewTransform();
355 void toggleSubjectHierarchyItemVisibility(vtkIdType itemID);
361 virtual void populateContextMenuForItem(vtkIdType itemID);
363 virtual void populateVisibilityContextMenuForItem(vtkIdType itemID);
365 virtual void populateTransformContextMenuForItem(vtkIdType itemID);
370 virtual bool clickDecoration(QMouseEvent* e);
372 void mousePressEvent(QMouseEvent* e)
override;
374 void keyPressEvent(QKeyEvent* e)
override;
382 vtkIdType firstSelectedSubjectHierarchyItemInBranch(vtkIdType itemID);
384 void changeEvent(QEvent* e)
override;
387 QScopedPointer<qMRMLSubjectHierarchyTreeViewPrivate>
d_ptr;
MRML node to represent a complete subject hierarchy tree.
A set of MRML Nodes that supports serialization and undo/redo.
void setPluginBlacklist(QStringList blocklist)
Deprecated. Use setPluginBlocklist instead.
Item model for subject hierarchy.
QScopedPointer< qMRMLSubjectHierarchyTreeViewPrivate > d_ptr
Abstract Superclass for all specific types of MRML nodes.