Slicer 5.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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
38class QStandardItem;
39class QAction;
40class QColor;
43
64class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyAbstractPlugin : public QObject
65{
66 Q_OBJECT
67 Q_ENUMS(ActionSectionType)
68
69
72 Q_PROPERTY(QString name READ name WRITE setName)
73 Q_PROPERTY(QString helpText READ helpText)
74
75public:
76 typedef QObject Superclass;
77 qSlicerSubjectHierarchyAbstractPlugin(QObject* parent = nullptr);
79
80// Role-related virtual methods
81// If the subclass plugin does not offer a role, these do not need to be overridden
82public:
89 Q_INVOKABLE virtual double canOwnSubjectHierarchyItem(vtkIdType itemID)const;
90
93 Q_INVOKABLE virtual const QString roleForPlugin()const;
94
96 virtual const QString helpText()const;
97
100 Q_INVOKABLE virtual QIcon icon(vtkIdType itemID);
101
103 Q_INVOKABLE virtual QIcon visibilityIcon(int visible);
104
106 Q_INVOKABLE virtual bool canEditProperties(vtkIdType itemID);
107
109 Q_INVOKABLE virtual void editProperties(vtkIdType itemID);
110
113 Q_INVOKABLE virtual QString displayedItemName(vtkIdType itemID)const;
114
116 Q_INVOKABLE virtual QString tooltip(vtkIdType itemID)const;
117
119 Q_INVOKABLE virtual void setDisplayVisibility(vtkIdType itemID, int visible);
120
123 Q_INVOKABLE virtual int getDisplayVisibility(vtkIdType itemID)const;
124
132 Q_INVOKABLE virtual void setDisplayColor(vtkIdType itemID, QColor color, QMap<int, QVariant> terminologyMetaData);
133
140 Q_INVOKABLE virtual QColor getDisplayColor(vtkIdType itemID, QMap<int, QVariant> &terminologyMetaData)const;
141
142 // Function related virtual methods
143public:
146 Q_INVOKABLE virtual QList<QAction*> itemContextMenuActions()const;
147
152 Q_INVOKABLE virtual QList<QAction*> sceneContextMenuActions()const;
153
156 Q_INVOKABLE virtual void showContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
157
160 Q_INVOKABLE virtual QList<QAction*> visibilityContextMenuActions()const;
161
164 Q_INVOKABLE virtual void showVisibilityContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
165
169 Q_INVOKABLE virtual QList<QAction*> transformContextMenuActions() const;
170
173 Q_INVOKABLE virtual void showTransformContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
174
178 Q_INVOKABLE virtual QList<QAction*> viewContextMenuActions()const;
179
183 Q_INVOKABLE virtual void showViewContextMenuActionsForItem(vtkIdType itemID, QVariantMap eventData) { Q_UNUSED(itemID); Q_UNUSED(eventData); };
184
185// Parenting related virtual methods with default implementation
186public:
196 Q_INVOKABLE virtual double canAddNodeToSubjectHierarchy(
197 vtkMRMLNode* node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID )const;
198
204 Q_INVOKABLE virtual bool addNodeToSubjectHierarchy(vtkMRMLNode* node, vtkIdType parentItemID);
205
214 Q_INVOKABLE virtual double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID)const;
215
218 Q_INVOKABLE virtual bool reparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID);
219
224 Q_INVOKABLE virtual bool showItemInView(vtkIdType itemID, vtkMRMLAbstractViewNode* viewNode, vtkIdList* allItemsToShow);
225
226// Utility functions
227public:
229 Q_INVOKABLE bool isThisPluginOwnerOfItem(vtkIdType itemID)const;
230
233 Q_INVOKABLE static qSlicerAbstractModuleWidget* switchToModule(QString moduleName);
234
235public:
237 virtual QString name()const;
238
241 virtual void setName(QString name);
242
244 {
245 SectionTop = -400,
246 SectionInteraction = -300,
247 SectionComponent = -200,
248 SectionNode = -100,
249 SectionDefault = 0,
250 SectionFolder = 100,
251 SectionBottom = 200,
252 };
253
263 Q_INVOKABLE static void setActionPosition(QAction* action, int section, int weight = 0, double weightAdjustment = 0.0);
264
265signals:
267 void requestExpandItem(vtkIdType itemID);
268
272
273protected:
279
280protected:
282 QString m_Name;
283
284private:
286 void operator=(const qSlicerSubjectHierarchyAbstractPlugin&); // Not implemented
289};
290
291#endif
Abstract plugin for handling Subject Hierarchy items.
virtual Q_INVOKABLE QList< QAction * > transformContextMenuActions() const
void requestExpandItem(vtkIdType itemID)
Signal requesting expanding of the subject hierarchy tree item belonging to an item.
static Q_INVOKABLE void setActionPosition(QAction *action, int section, int weight=0, double weightAdjustment=0.0)
virtual void setName(QString name)
virtual Q_INVOKABLE QList< QAction * > viewContextMenuActions() const
virtual Q_INVOKABLE void showTransformContextMenuActionsForItem(vtkIdType itemID)
virtual Q_INVOKABLE QList< QAction * > visibilityContextMenuActions() const
virtual Q_INVOKABLE double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID) const
Q_INVOKABLE bool isThisPluginOwnerOfItem(vtkIdType itemID) const
Determines if the item is owned by this plugin.
virtual QString name() const
Get the name of the plugin.
virtual Q_INVOKABLE bool addNodeToSubjectHierarchy(vtkMRMLNode *node, vtkIdType parentItemID)
static Q_INVOKABLE qSlicerAbstractModuleWidget * switchToModule(QString moduleName)
virtual Q_INVOKABLE bool reparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID)
virtual Q_INVOKABLE bool showItemInView(vtkIdType itemID, vtkMRMLAbstractViewNode *viewNode, vtkIdList *allItemsToShow)
virtual Q_INVOKABLE void showViewContextMenuActionsForItem(vtkIdType itemID, QVariantMap eventData)
virtual Q_INVOKABLE void showVisibilityContextMenuActionsForItem(vtkIdType itemID)
virtual Q_INVOKABLE double canAddNodeToSubjectHierarchy(vtkMRMLNode *node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID) const
Qt-based logic class to exercise Qt-related logic functions. The Subject hierarchy plugin mechanism a...
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D,...
Abstract Superclass for all specific types of MRML nodes.