Slicer 5.4
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
65class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qSlicerSubjectHierarchyAbstractPlugin : public QObject
66{
67 Q_OBJECT
68 Q_ENUMS(ActionSectionType)
69
70
73 Q_PROPERTY(QString name READ name WRITE setName)
74 Q_PROPERTY(QString helpText READ helpText)
75
76public:
77 typedef QObject Superclass;
78 qSlicerSubjectHierarchyAbstractPlugin(QObject* parent = nullptr);
80
81// Role-related virtual methods
82// If the subclass plugin does not offer a role, these do not need to be overridden
83public:
90 Q_INVOKABLE virtual double canOwnSubjectHierarchyItem(vtkIdType itemID)const;
91
94 Q_INVOKABLE virtual const QString roleForPlugin()const;
95
97 virtual const QString helpText()const;
98
101 Q_INVOKABLE virtual QIcon icon(vtkIdType itemID);
102
104 Q_INVOKABLE virtual QIcon visibilityIcon(int visible);
105
107 Q_INVOKABLE virtual bool canEditProperties(vtkIdType itemID);
108
110 Q_INVOKABLE virtual void editProperties(vtkIdType itemID);
111
114 Q_INVOKABLE virtual QString displayedItemName(vtkIdType itemID)const;
115
117 Q_INVOKABLE virtual QString tooltip(vtkIdType itemID)const;
118
120 Q_INVOKABLE virtual void setDisplayVisibility(vtkIdType itemID, int visible);
121
124 Q_INVOKABLE virtual int getDisplayVisibility(vtkIdType itemID)const;
125
133 Q_INVOKABLE virtual void setDisplayColor(vtkIdType itemID, QColor color, QMap<int, QVariant> terminologyMetaData);
134
141 Q_INVOKABLE virtual QColor getDisplayColor(vtkIdType itemID, QMap<int, QVariant> &terminologyMetaData)const;
142
143 // Function related virtual methods
144public:
147 Q_INVOKABLE virtual QList<QAction*> itemContextMenuActions()const;
148
153 Q_INVOKABLE virtual QList<QAction*> sceneContextMenuActions()const;
154
157 Q_INVOKABLE virtual void showContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
158
161 Q_INVOKABLE virtual QList<QAction*> visibilityContextMenuActions()const;
162
165 Q_INVOKABLE virtual void showVisibilityContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
166
170 Q_INVOKABLE virtual QList<QAction*> viewContextMenuActions()const;
171
175 Q_INVOKABLE virtual void showViewContextMenuActionsForItem(vtkIdType itemID, QVariantMap eventData) { Q_UNUSED(itemID); Q_UNUSED(eventData); };
176
177// Parenting related virtual methods with default implementation
178public:
188 Q_INVOKABLE virtual double canAddNodeToSubjectHierarchy(
189 vtkMRMLNode* node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID )const;
190
196 Q_INVOKABLE virtual bool addNodeToSubjectHierarchy(vtkMRMLNode* node, vtkIdType parentItemID);
197
206 Q_INVOKABLE virtual double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID)const;
207
210 Q_INVOKABLE virtual bool reparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID);
211
216 Q_INVOKABLE virtual bool showItemInView(vtkIdType itemID, vtkMRMLAbstractViewNode* viewNode, vtkIdList* allItemsToShow);
217
218// Utility functions
219public:
221 Q_INVOKABLE bool isThisPluginOwnerOfItem(vtkIdType itemID)const;
222
225 Q_INVOKABLE static qSlicerAbstractModuleWidget* switchToModule(QString moduleName);
226
227public:
229 virtual QString name()const;
230
233 virtual void setName(QString name);
234
236 {
237 SectionTop = -400,
238 SectionInteraction = -300,
239 SectionComponent = -200,
240 SectionNode = -100,
241 SectionDefault = 0,
242 SectionFolder = 100,
243 SectionBottom = 200,
244 };
245
255 Q_INVOKABLE static void setActionPosition(QAction* action, int section, int weight = 0, double weightAdjustment = 0.0);
256
257signals:
259 void requestExpandItem(vtkIdType itemID);
260
264
265protected:
271
272protected:
274 QString m_Name;
275
276private:
278 void operator=(const qSlicerSubjectHierarchyAbstractPlugin&); // Not implemented
281};
282
283#endif
Abstract plugin for handling Subject Hierarchy items.
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 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.