Slicer 5.6
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
qSlicerSubjectHierarchyPluginLogic.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
6 Queen's University, Kingston, ON, Canada. All Rights Reserved.
7
8 See COPYRIGHT.txt
9 or http://www.slicer.org/copyright/copyright.txt for details.
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16
17 This file was originally developed by Csaba Pinter, PerkLab, Queen's University
18 and was supported through the Applied Cancer Research Unit program of Cancer Care
19 Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
20
21==============================================================================*/
22
23#ifndef __qSlicerSubjectHierarchyPluginLogic_h
24#define __qSlicerSubjectHierarchyPluginLogic_h
25
26// Slicer includes
27#include "qSlicerObject.h"
28
29// CTK includes
30#include <ctkVTKObject.h>
31
32// Qt includes
33#include <QObject>
34
35// MRML includes
36#include <vtkMRMLScene.h>
38
39#include "qSlicerSubjectHierarchyModuleWidgetsExport.h"
40
41class QAction;
42class QMenu;
43class qSlicerSubjectHierarchyPluginLogicPrivate;
45
48class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyPluginLogic :
49 public QObject, public virtual qSlicerObject
50{
51 Q_OBJECT
52 QVTK_OBJECT
53
56 Q_PROPERTY(QStringList allowedViewContextMenuActionNames READ allowedViewContextMenuActionNames WRITE setAllowedViewContextMenuActionNames)
58 Q_PROPERTY(QStringList registeredViewContextMenuActionNames READ registeredViewContextMenuActionNames)
59
60public:
61 typedef QObject Superclass;
62 qSlicerSubjectHierarchyPluginLogic(QObject *parent=nullptr);
64
65public:
67 void setMRMLScene(vtkMRMLScene* scene) override;
68
70 Q_INVOKABLE qSlicerSubjectHierarchyAbstractPlugin* subjectHierarchyPluginByName(QString name)const;
71
73 Q_INVOKABLE vtkIdType currentSubjectHierarchyItem()const;
74
77 Q_INVOKABLE void setCurrentSubjectHierarchyItem(vtkIdType itemID);
78
82 void registerCorePlugins();
83
86 QStringList registeredViewContextMenuActionNames();
87
93 void setAllowedViewContextMenuActionNames(QStringList actionObjectNames);
94
96 QStringList allowedViewContextMenuActionNames() const;
97
103 Q_INVOKABLE void setAllowedViewContextMenuActionNamesForItem(vtkIdType itemID, const QStringList& actionObjectNames);
104
107 Q_INVOKABLE QStringList allowedViewContextMenuActionNamesForItem(vtkIdType itemID);
108
115 static Q_INVOKABLE QString buildMenuFromActions(QMenu* menu, QList< QAction* > actions, const QStringList& allowedActions=QStringList());
116
117protected:
119 void observeNode(vtkMRMLNode* node);
120
125 void addSupportedDataNodesToSubjectHierarchy();
126
128 void registerViewContextMenuAction(QAction* action);
129
130protected slots:
132 void onNodeAdded(vtkObject* scene, vtkObject* nodeObject);
135 void onNodeAboutToBeRemoved(vtkObject* scene, vtkObject* nodeObject);
138 void onNodeRemoved(vtkObject* scene, vtkObject* nodeObject);
142 void onSceneImportEnded(vtkObject* sceneObject);
144 void onSceneCloseEnded(vtkObject* sceneObject);
147 void onSceneRestoreEnded(vtkObject* sceneObject);
150 void onSceneBatchProcessEnded(vtkObject* sceneObject);
151
153 void onDisplayNodeModified(vtkObject*, vtkObject*);
155 void onDisplayMenuEvent(vtkObject*, vtkObject*);
157 void editProperties();
158
159protected:
160 QScopedPointer<qSlicerSubjectHierarchyPluginLogicPrivate> d_ptr;
161
162private:
163 Q_DECLARE_PRIVATE(qSlicerSubjectHierarchyPluginLogic);
166};
167
168#endif
Abstract plugin for handling Subject Hierarchy items.
Singleton class managing Subject Hierarchy plugins.
Qt-based logic class to exercise Qt-related logic functions. The Subject hierarchy plugin mechanism a...
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.