21 #ifndef __qMRMLTreeView_h 22 #define __qMRMLTreeView_h 30 #include <ctkVTKObject.h> 35 #include "qMRMLWidgetsExport.h" 37 class qMRMLTreeViewPrivate;
58 Q_PROPERTY(QString sceneModelType READ sceneModelType WRITE setSceneModelType)
64 Q_PROPERTY(
qMRMLSceneModel::NodeTypes listenNodeModifiedEvent READ listenNodeModifiedEvent WRITE setListenNodeModifiedEvent)
74 Q_PROPERTY(QStringList nodeTypes READ nodeTypes WRITE setNodeTypes)
77 Q_PROPERTY(
bool fitSizeToVisibleIndexes READ fitSizeToVisibleIndexes WRITE setFitSizeToVisibleIndexes)
83 Q_PROPERTY(QSize minSizeHint READ minSizeHint WRITE setMinSizeHint)
87 Q_PROPERTY(
bool renameMenuActionVisible READ isRenameMenuActionVisible WRITE setRenameMenuActionVisible)
91 Q_PROPERTY(
bool deleteMenuActionVisible READ isDeleteMenuActionVisible WRITE setDeleteMenuActionVisible)
95 Q_PROPERTY(
bool editMenuActionVisible READ isEditMenuActionVisible WRITE setEditMenuActionVisible)
100 Q_PROPERTY(
bool showHidden READ showHidden WRITE setShowHidden)
106 Q_PROPERTY(
bool showScene READ showScene WRITE setShowScene)
116 Q_PROPERTY(
bool showRootNode READ showRootNode WRITE setShowRootNode)
134 QString sceneModelType()const;
144 void setSceneModel(
qMRMLSceneModel* newSceneModel, const QString& modelType);
151 QStringList nodeTypes()const;
152 void setNodeTypes(const QStringList& nodeTypes);
156 bool isRenameMenuActionVisible()const;
157 void setRenameMenuActionVisible(
bool show);
161 bool isDeleteMenuActionVisible()const;
162 void setDeleteMenuActionVisible(
bool show);
166 bool isEditMenuActionVisible()const;
167 void setEditMenuActionVisible(
bool show);
172 void appendNodeMenuAction(QAction* action);
175 void prependNodeMenuAction(QAction* action);
180 void appendSceneMenuAction(QAction* action);
183 void prependSceneMenuAction(QAction* action);
186 void removeNodeMenuAction(QAction* action);
190 inline
void setShowHidden(
bool);
191 inline
bool showHidden()const;
195 void setShowRootNode(
bool show);
198 bool showRootNode()const;
202 void setShowScene(
bool show);
205 bool showScene()const;
219 void setFitSizeToVisibleIndexes(
bool);
220 bool fitSizeToVisibleIndexes()const;
222 void setMinSizeHint(QSize min);
223 QSize minSizeHint()const;
227 static
bool isAncestor(const QModelIndex& index, const QModelIndex& potentialAncestor);
231 static QModelIndex findAncestor(const QModelIndex& index, const QModelIndexList& potentialAncestors);
234 static QModelIndexList removeChildren(const QModelIndexList& indexes);
236 QSize minimumSizeHint()const override;
237 QSize sizeHint()const override;
239 void showEvent(QShowEvent* show) override;
240 bool eventFilter(QObject*
object, QEvent* e) override;
242 virtual
bool clickDecoration(const QModelIndex& index);
244 using QTreeView::scrollTo;
251 void setSceneModelType(const QString& modelType);
262 void deleteCurrentNode();
263 void editCurrentNode();
264 void renameCurrentNode();
268 inline
void setShowAll(
bool);
271 inline
void setHideAll(
bool);
274 inline
void setDontHideAll(
bool);
283 void scrollTo(const QString& displayName);
293 void currentNodeDeleted(const QModelIndex& index);
294 void currentNodeRenamed(const QString& newName);
296 void decorationClicked(const QModelIndex&);
301 virtual
void onSelectionChanged(const QItemSelection & selected,
302 const QItemSelection & deselected);
304 void onNumberOfVisibleIndexChanged();
306 void updateRootNode(vtkObject* modifiedRootNode);
312 void saveTreeExpandState();
316 void loadTreeExpandState();
318 void onCustomContextMenu(const QPoint& point);
321 qMRMLTreeView(qMRMLTreeViewPrivate* pimpl, QWidget *parent=
nullptr);
324 QScopedPointer<qMRMLTreeViewPrivate> d_ptr;
327 void updateGeometries() override;
328 void mousePressEvent(QMouseEvent* event) override;
329 void mouseReleaseEvent(QMouseEvent* event) override;
330 void keyPressEvent(QKeyEvent* event) override;
332 virtual
void toggleVisibility(const QModelIndex& index);
348 return this->sortFilterProxyModel()->showHidden();
354 this->sortFilterProxyModel()->setShowAll(show);
360 this->sortFilterProxyModel()->setHideAll(hide);
366 qDebug() <<
"DontHide: " << dontHide;
367 this->setHideAll(!dontHide);
void setDontHideAll(bool)
A set of MRML Nodes that supports serialization and undo/redo.
Abstract Superclass for all specific types of MRML nodes.