Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerSubjectHierarchyAbstractPlugin.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 __qSlicerSubjectHierarchyAbstractPlugin_h
24 #define __qSlicerSubjectHierarchyAbstractPlugin_h
25 
26 // Qt includes
27 #include <QObject>
28 #include <QMap>
29 #include <QStringList>
30 #include <QIcon>
31 #include <QVariant>
32 
33 // MRML includes
35 
36 #include "qSlicerSubjectHierarchyModuleWidgetsExport.h"
37 
38 class QStandardItem;
39 class QAction;
40 class QColor;
43 
65 class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyAbstractPlugin : public QObject
66 {
67  Q_OBJECT
68 
72  Q_PROPERTY(QString name READ name WRITE setName)
73 
74 public:
75  typedef QObject Superclass;
76  qSlicerSubjectHierarchyAbstractPlugin(QObject* parent = nullptr);
78 
79 // Role-related virtual methods
80 // If the subclass plugin does not offer a role, these do not need to be overridden
81 public:
88  Q_INVOKABLE virtual double canOwnSubjectHierarchyItem(vtkIdType itemID)const;
89 
92  Q_INVOKABLE virtual const QString roleForPlugin()const;
93 
95  virtual const QString helpText()const;
96 
99  virtual QIcon icon(vtkIdType itemID);
100 
102  Q_INVOKABLE virtual QIcon visibilityIcon(int visible);
103 
105  Q_INVOKABLE virtual void editProperties(vtkIdType itemID);
106 
109  virtual QString displayedItemName(vtkIdType itemID)const;
110 
112  Q_INVOKABLE virtual QString tooltip(vtkIdType itemID)const;
113 
115  Q_INVOKABLE virtual void setDisplayVisibility(vtkIdType itemID, int visible);
116 
119  Q_INVOKABLE virtual int getDisplayVisibility(vtkIdType itemID)const;
120 
128  Q_INVOKABLE virtual void setDisplayColor(vtkIdType itemID, QColor color, QMap<int, QVariant> terminologyMetaData);
129 
136  Q_INVOKABLE virtual QColor getDisplayColor(vtkIdType itemID, QMap<int, QVariant> &terminologyMetaData)const;
137 
138  // Function related virtual methods
139 public:
142  Q_INVOKABLE virtual QList<QAction*> itemContextMenuActions()const;
143 
148  Q_INVOKABLE virtual QList<QAction*> sceneContextMenuActions()const;
149 
152  Q_INVOKABLE virtual void showContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
153 
156  Q_INVOKABLE virtual QList<QAction*> visibilityContextMenuActions()const;
157 
160  Q_INVOKABLE virtual void showVisibilityContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
161 
165  Q_INVOKABLE virtual QList<QAction*> viewContextMenuActions()const;
166 
170  Q_INVOKABLE virtual void showViewContextMenuActionsForItem(vtkIdType itemID, QVariantMap eventData) { Q_UNUSED(itemID); Q_UNUSED(eventData); };
171 
172 // Parenting related virtual methods with default implementation
173 public:
183  virtual double canAddNodeToSubjectHierarchy(
184  vtkMRMLNode* node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID )const;
185 
191  virtual bool addNodeToSubjectHierarchy(vtkMRMLNode* node, vtkIdType parentItemID);
192 
201  virtual double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID)const;
202 
205  virtual bool reparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID);
206 
211  virtual bool showItemInView(vtkIdType itemID, vtkMRMLAbstractViewNode* viewNode, vtkIdList* allItemsToShow);
212 
213 // Utility functions
214 public:
216  Q_INVOKABLE bool isThisPluginOwnerOfItem(vtkIdType itemID)const;
217 
220  Q_INVOKABLE static qSlicerAbstractModuleWidget* switchToModule(QString moduleName);
221 
222 public:
224  virtual QString name()const;
225 
228  virtual void setName(QString name);
229 
230 signals:
232  void requestExpandItem(vtkIdType itemID);
233 
236  void requestInvalidateFilter()const;
237 
238 protected:
243  void hideAllContextMenuActions()const;
244 
245 protected:
247  QString m_Name;
248 
249 private:
251  void operator=(const qSlicerSubjectHierarchyAbstractPlugin&); // Not implemented
254 };
255 
256 #endif
Abstract plugin for handling Subject Hierarchy items.
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D...
Qt-based logic class to exercise Qt-related logic functions. The Subject hierarchy plugin mechanism a...
virtual Q_INVOKABLE void showContextMenuActionsForItem(vtkIdType itemID)
virtual Q_INVOKABLE void showViewContextMenuActionsForItem(vtkIdType itemID, QVariantMap eventData)
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
virtual Q_INVOKABLE void showVisibilityContextMenuActionsForItem(vtkIdType itemID)