21 #ifndef __qMRMLTreeView_h 22 #define __qMRMLTreeView_h 30 #include <ctkVTKObject.h> 35 #include "qMRMLWidgetsExport.h" 37 class qMRMLTreeViewPrivate;
59 Q_PROPERTY(QString sceneModelType READ sceneModelType WRITE setSceneModelType)
65 Q_PROPERTY(
qMRMLSceneModel::NodeTypes listenNodeModifiedEvent READ listenNodeModifiedEvent WRITE setListenNodeModifiedEvent)
75 Q_PROPERTY(QStringList nodeTypes READ nodeTypes WRITE setNodeTypes)
78 Q_PROPERTY(
bool fitSizeToVisibleIndexes READ fitSizeToVisibleIndexes WRITE setFitSizeToVisibleIndexes)
84 Q_PROPERTY(QSize minSizeHint READ minSizeHint WRITE setMinSizeHint)
88 Q_PROPERTY(
bool renameMenuActionVisible READ isRenameMenuActionVisible WRITE setRenameMenuActionVisible)
92 Q_PROPERTY(
bool deleteMenuActionVisible READ isDeleteMenuActionVisible WRITE setDeleteMenuActionVisible)
96 Q_PROPERTY(
bool editMenuActionVisible READ isEditMenuActionVisible WRITE setEditMenuActionVisible)
101 Q_PROPERTY(
bool showHidden READ showHidden WRITE setShowHidden)
107 Q_PROPERTY(
bool showScene READ showScene WRITE setShowScene)
117 Q_PROPERTY(
bool showRootNode READ showRootNode WRITE setShowRootNode)
135 QString sceneModelType()const;
145 void setSceneModel(
qMRMLSceneModel* newSceneModel, const QString& modelType);
152 QStringList nodeTypes()const;
153 void setNodeTypes(const QStringList& nodeTypes);
157 bool isRenameMenuActionVisible()const;
158 void setRenameMenuActionVisible(
bool show);
162 bool isDeleteMenuActionVisible()const;
163 void setDeleteMenuActionVisible(
bool show);
167 bool isEditMenuActionVisible()const;
168 void setEditMenuActionVisible(
bool show);
173 void appendNodeMenuAction(QAction* action);
176 void prependNodeMenuAction(QAction* action);
181 void appendSceneMenuAction(QAction* action);
184 void prependSceneMenuAction(QAction* action);
187 void removeNodeMenuAction(QAction* action);
191 inline
void setShowHidden(
bool);
192 inline
bool showHidden()const;
196 void setShowRootNode(
bool show);
199 bool showRootNode()const;
203 void setShowScene(
bool show);
206 bool showScene()const;
220 void setFitSizeToVisibleIndexes(
bool);
221 bool fitSizeToVisibleIndexes()const;
223 void setMinSizeHint(QSize min);
224 QSize minSizeHint()const;
228 static
bool isAncestor(const QModelIndex& index, const QModelIndex& potentialAncestor);
232 static QModelIndex findAncestor(const QModelIndex& index, const QModelIndexList& potentialAncestors);
235 static QModelIndexList removeChildren(const QModelIndexList& indexes);
237 virtual QSize minimumSizeHint()const;
238 virtual QSize sizeHint()const;
240 virtual
void showEvent(QShowEvent* show);
241 virtual
bool eventFilter(QObject*
object, QEvent* e);
243 virtual
bool clickDecoration(const QModelIndex& index);
245 using QTreeView::scrollTo;
252 void setSceneModelType(const QString& modelType);
263 void deleteCurrentNode();
264 void editCurrentNode();
265 void renameCurrentNode();
269 inline
void setShowAll(
bool);
272 inline
void setHideAll(
bool);
275 inline
void setDontHideAll(
bool);
284 void scrollTo(const QString& displayName);
294 void currentNodeDeleted(const QModelIndex& index);
295 void currentNodeRenamed(const QString& newName);
297 void decorationClicked(const QModelIndex&);
302 virtual
void onSelectionChanged(const QItemSelection & selected,
303 const QItemSelection & deselected);
305 void onNumberOfVisibleIndexChanged();
307 void updateRootNode(vtkObject* modifiedRootNode);
313 void saveTreeExpandState();
317 void loadTreeExpandState();
320 qMRMLTreeView(qMRMLTreeViewPrivate* pimpl, QWidget *parent=0);
323 QScopedPointer<qMRMLTreeViewPrivate> d_ptr;
326 virtual
void updateGeometries();
327 virtual
void mousePressEvent(QMouseEvent* event);
328 virtual
void mouseReleaseEvent(QMouseEvent* event);
329 virtual
void keyPressEvent(QKeyEvent* event);
331 virtual
void toggleVisibility(const QModelIndex& index);
334 Q_DECLARE_PRIVATE(qMRMLTreeView);
335 Q_DISABLE_COPY(qMRMLTreeView);
339 void qMRMLTreeView::setShowHidden(
bool enable)
341 this->sortFilterProxyModel()->setShowHidden(enable);
347 return this->sortFilterProxyModel()->showHidden();
353 this->sortFilterProxyModel()->setShowAll(show);
359 this->sortFilterProxyModel()->setHideAll(hide);
365 qDebug() <<
"DontHide: " << dontHide;
366 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.