Slicer 5.9
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
133 Q_INVOKABLE virtual void setDisplayColor(vtkIdType itemID, QColor color, QMap<int, QVariant> terminologyMetaData);
134
142 Q_INVOKABLE virtual QColor getDisplayColor(vtkIdType itemID, QMap<int, QVariant> &terminologyMetaData)const;
143
144 // Function related virtual methods
145public:
148 Q_INVOKABLE virtual QList<QAction*> itemContextMenuActions()const;
149
154 Q_INVOKABLE virtual QList<QAction*> sceneContextMenuActions()const;
155
158 Q_INVOKABLE virtual void showContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
159
163
166 Q_INVOKABLE virtual void showVisibilityContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
167
171 Q_INVOKABLE virtual QList<QAction*> transformContextMenuActions() const;
172
175 Q_INVOKABLE virtual void showTransformContextMenuActionsForItem(vtkIdType itemID) { Q_UNUSED(itemID); };
176
180 Q_INVOKABLE virtual QList<QAction*> viewContextMenuActions()const;
181
185 Q_INVOKABLE virtual void showViewContextMenuActionsForItem(vtkIdType itemID, QVariantMap eventData) { Q_UNUSED(itemID); Q_UNUSED(eventData); };
186
187// Parenting related virtual methods with default implementation
188public:
198 Q_INVOKABLE virtual double canAddNodeToSubjectHierarchy(
199 vtkMRMLNode* node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID )const;
200
206 Q_INVOKABLE virtual bool addNodeToSubjectHierarchy(vtkMRMLNode* node, vtkIdType parentItemID);
207
216 Q_INVOKABLE virtual double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID)const;
217
220 Q_INVOKABLE virtual bool reparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID);
221
226 Q_INVOKABLE virtual bool showItemInView(vtkIdType itemID, vtkMRMLAbstractViewNode* viewNode, vtkIdList* allItemsToShow);
227
228// Utility functions
229public:
231 Q_INVOKABLE bool isThisPluginOwnerOfItem(vtkIdType itemID)const;
232
235 Q_INVOKABLE static qSlicerAbstractModuleWidget* switchToModule(QString moduleName);
236
237public:
239 virtual QString name()const;
240
243 virtual void setName(QString name);
244
255
265 Q_INVOKABLE static void setActionPosition(QAction* action, int section, int weight = 0, double weightAdjustment = 0.0);
266
267 // @{
270 Q_INVOKABLE void setColorAndTerminologyToDisplayableNode(vtkIdType itemID, QColor color,
271 QMap<int, QVariant> terminologyMetaData, bool useSelectedColor, bool disableScalarVisibility);
272 Q_INVOKABLE QColor colorAndTerminologyFromDisplayableNode(vtkIdType itemID,
273 QMap<int, QVariant>& terminologyMetaData, bool useSelectedColor)const;
274 // @}
275
276signals:
278 void requestExpandItem(vtkIdType itemID);
279
283
284protected:
290
291protected:
293 QString m_Name;
294
295private:
297 void operator=(const qSlicerSubjectHierarchyAbstractPlugin&); // Not implemented
300};
301
302#endif
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 * > itemContextMenuActions() const
virtual Q_INVOKABLE QList< QAction * > viewContextMenuActions() const
virtual Q_INVOKABLE void showTransformContextMenuActionsForItem(vtkIdType itemID)
qSlicerSubjectHierarchyAbstractPlugin(QObject *parent=nullptr)
virtual Q_INVOKABLE QList< QAction * > visibilityContextMenuActions() const
virtual Q_INVOKABLE double canReparentItemInsideSubjectHierarchy(vtkIdType itemID, vtkIdType parentItemID) const
virtual Q_INVOKABLE void setDisplayVisibility(vtkIdType itemID, int visible)
Set display visibility of an owned subject hierarchy item.
Q_INVOKABLE void setColorAndTerminologyToDisplayableNode(vtkIdType itemID, QColor color, QMap< int, QVariant > terminologyMetaData, bool useSelectedColor, bool disableScalarVisibility)
virtual Q_INVOKABLE QList< QAction * > sceneContextMenuActions() const
Q_INVOKABLE bool isThisPluginOwnerOfItem(vtkIdType itemID) const
Determines if the item is owned by this plugin.
virtual Q_INVOKABLE const QString roleForPlugin() const
virtual QString name() const
Get the name of the plugin.
virtual Q_INVOKABLE QIcon visibilityIcon(int visible)
Get visibility icon for a visibility state.
virtual Q_INVOKABLE QString displayedItemName(vtkIdType itemID) const
virtual Q_INVOKABLE bool addNodeToSubjectHierarchy(vtkMRMLNode *node, vtkIdType parentItemID)
virtual Q_INVOKABLE QColor getDisplayColor(vtkIdType itemID, QMap< int, QVariant > &terminologyMetaData) const
virtual Q_INVOKABLE QString tooltip(vtkIdType itemID) const
Generate tooltip for a owned subject hierarchy item.
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)
Q_INVOKABLE QColor colorAndTerminologyFromDisplayableNode(vtkIdType itemID, QMap< int, QVariant > &terminologyMetaData, bool useSelectedColor) const
virtual Q_INVOKABLE int getDisplayVisibility(vtkIdType itemID) const
virtual Q_INVOKABLE void showViewContextMenuActionsForItem(vtkIdType itemID, QVariantMap eventData)
virtual Q_INVOKABLE void showVisibilityContextMenuActionsForItem(vtkIdType itemID)
virtual Q_INVOKABLE void setDisplayColor(vtkIdType itemID, QColor color, QMap< int, QVariant > terminologyMetaData)
virtual Q_INVOKABLE void editProperties(vtkIdType itemID)
Open module belonging to item and set inputs in opened module.
virtual Q_INVOKABLE bool canEditProperties(vtkIdType itemID)
Returns true if the module can edit properties of this item using editProperties.
virtual Q_INVOKABLE void showContextMenuActionsForItem(vtkIdType itemID)
virtual Q_INVOKABLE QIcon icon(vtkIdType itemID)
@ SectionTop
Use this section to make items appear at the top of the menu.
@ SectionBottom
Use this section to make items appear at the bottom of the menu.
@ SectionDefault
By default (if no position is defined) actions will appear in this section.
@ SectionInteraction
Actions for changing the current interaction mode (in view context menu).
@ SectionComponent
Actions for the selected node component (e.g., control point within a node).
virtual Q_INVOKABLE double canAddNodeToSubjectHierarchy(vtkMRMLNode *node, vtkIdType parentItemID=vtkMRMLSubjectHierarchyNode::INVALID_ITEM_ID) const
virtual Q_INVOKABLE double canOwnSubjectHierarchyItem(vtkIdType itemID) const
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.
QMap< QString, QVariant > QVariantMap