Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
qMRMLSubjectHierarchyComboBox.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 __qMRMLSubjectHierarchyComboBox_h
24#define __qMRMLSubjectHierarchyComboBox_h
25
26// CTK includes
27#include <ctkComboBox.h>
28#include <ctkVTKObject.h>
29
30// SubjectHierarchy includes
31#include "qSlicerSubjectHierarchyModuleWidgetsExport.h"
32
34
35class qMRMLSubjectHierarchyComboBoxPrivate;
38class vtkMRMLScene;
39
40class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qMRMLSubjectHierarchyComboBox : public ctkComboBox
41{
42 Q_OBJECT
43 QVTK_OBJECT
44
49 Q_PROPERTY(bool showRootItem READ showRootItem WRITE setShowRootItem)
62 Q_PROPERTY(bool noneEnabled READ noneEnabled WRITE setNoneEnabled)
66 Q_PROPERTY(QString noneDisplay READ noneDisplay WRITE setNoneDisplay)
76
87
97
98 Q_PROPERTY(QStringList nodeTypes READ nodeTypes WRITE setNodeTypes)
99
100public:
101 typedef ctkComboBox Superclass;
102 qMRMLSubjectHierarchyComboBox(QWidget* parent = nullptr);
104
105public:
106 Q_INVOKABLE vtkMRMLScene* mrmlScene() const;
108
109 Q_INVOKABLE void clearSelection();
110 Q_INVOKABLE vtkIdType currentItem() const;
111 Q_INVOKABLE vtkIdType rootItem() const;
113 Q_INVOKABLE virtual vtkMRMLNode* currentNode() const;
114
116 Q_INVOKABLE virtual void setCurrentNode(vtkMRMLNode*);
117
118 void setShowRootItem(bool show);
119 bool showRootItem() const;
120
122 void setHighlightReferencedItems(bool highlightOn);
123
125 void setMaximumNumberOfShownItems(int maxNumberOfShownItems);
126
128 void setAlignPopupVertically(bool align);
129
130 bool noneEnabled() const;
131 void setNoneEnabled(bool enable);
132
133 QString noneDisplay() const;
134 void setNoneDisplay(const QString& displayName);
135
137 void setShowCurrentItemParents(bool enable);
138
141
146 QString attributeValueFilter() const;
147 QString attributeNameFilter() const;
155 Q_INVOKABLE void addItemAttributeFilter(QString attributeName, QVariant attributeValue = QString(), bool include = true);
157 Q_INVOKABLE void removeItemAttributeFilter(QString attributeName, QVariant attributeValue, bool include);
159 Q_INVOKABLE void removeItemAttributeFilter(QString attributeName, bool include);
168 Q_INVOKABLE void addNodeAttributeFilter(QString attributeName, QVariant attributeValue = QString(), bool include = true, QString className = QString());
170 Q_INVOKABLE void removeNodeAttributeFilter(QString attributeName, QVariant attributeValue, bool include, QString className);
172 Q_INVOKABLE void removeNodeAttributeFilter(QString attributeName, bool include);
173
175 Q_INVOKABLE void setLevelFilter(QStringList& levelFilter);
177 Q_INVOKABLE void setNodeTypes(const QStringList& types);
178 QStringList nodeTypes() const;
179
182 Q_INVOKABLE void setHideChildNodeTypes(const QStringList& types);
183
185 Q_INVOKABLE qMRMLSubjectHierarchyModel* model() const;
186
187public:
189 void showPopup() override;
190
191public slots:
193 virtual void setMRMLScene(vtkMRMLScene* scene);
194
196 virtual void setCurrentItem(vtkIdType itemID);
197
199 virtual void setRootItem(vtkIdType itemID);
200
204 void setPluginAllowlist(QStringList allowlist);
208 void setPluginBlocklist(QStringList blocklist);
211 void disablePlugin(QString plugin);
212
214 void setPluginWhitelist(QStringList allowlist)
215 {
216 qWarning("qMRMLSubjectHierarchyComboBox::setPluginWhitelist is deprecated. Use setPluginAllowlist instead.");
217 this->setPluginAllowlist(allowlist);
218 }
219
220 void setPluginBlacklist(QStringList blocklist)
221 {
222 qWarning("qMRMLSubjectHierarchyComboBox::setPluginBlacklist is deprecated. Use setPluginBlocklist instead.");
223 this->setPluginBlocklist(blocklist);
224 }
225
226 void setIncludeItemAttributeNamesFilter(QStringList filter);
227 void setIncludeNodeAttributeNamesFilter(QStringList filter);
228 void setExcludeItemAttributeNamesFilter(QStringList filter);
229 void setExcludeNodeAttributeNamesFilter(QStringList filter);
230 void setAttributeNameFilter(QString& filter);
231 void setAttributeValueFilter(QString& filter);
232
233signals:
234 void currentItemChanged(vtkIdType);
235 void currentItemModified(vtkIdType);
236
237protected slots:
238 void updateComboBoxTitleAndIcon(vtkIdType selectedShItemID);
239
240 void hidePopup() override;
241
242 virtual void onMRMLSceneCloseEnded(vtkObject* sceneObject);
243
244protected:
246 void mousePressEvent(QMouseEvent* event) override;
247
248protected:
249 QScopedPointer<qMRMLSubjectHierarchyComboBoxPrivate> d_ptr;
250
251private:
252 Q_DECLARE_PRIVATE(qMRMLSubjectHierarchyComboBox);
253 Q_DISABLE_COPY(qMRMLSubjectHierarchyComboBox);
254};
255
256#endif
qMRMLSubjectHierarchyComboBox(QWidget *parent=nullptr)
void setExcludeItemAttributeNamesFilter(QStringList filter)
Q_INVOKABLE vtkMRMLSubjectHierarchyNode * subjectHierarchyNode() const
virtual void setMRMLScene(vtkMRMLScene *scene)
Set MRML scene.
Q_INVOKABLE vtkMRMLScene * mrmlScene() const
void setPluginBlacklist(QStringList blocklist)
Deprecated. Use setPluginBlocklist instead.
virtual void onMRMLSceneCloseEnded(vtkObject *sceneObject)
void setPluginAllowlist(QStringList allowlist)
void setIncludeNodeAttributeNamesFilter(QStringList filter)
virtual Q_INVOKABLE void setCurrentNode(vtkMRMLNode *)
Convenience method to set the current item given a MRML data node.
void showPopup() override
Provides customized popup window for the tree view.
void disablePlugin(QString plugin)
void mousePressEvent(QMouseEvent *event) override
Handle mouse press event (disable context menu)
void setHighlightReferencedItems(bool highlightOn)
void currentItemModified(vtkIdType)
void setNoneEnabled(bool enable)
void updateComboBoxTitleAndIcon(vtkIdType selectedShItemID)
void setIncludeItemAttributeNamesFilter(QStringList filter)
void setNoneDisplay(const QString &displayName)
Q_INVOKABLE void removeNodeAttributeFilter(QString attributeName, QVariant attributeValue, bool include, QString className)
Remove single node attribute filter specifying each attribute.
void setExcludeNodeAttributeNamesFilter(QStringList filter)
Q_INVOKABLE void clearSelection()
void setPluginBlocklist(QStringList blocklist)
void setAttributeValueFilter(QString &filter)
QScopedPointer< qMRMLSubjectHierarchyComboBoxPrivate > d_ptr
void setAttributeNameFilter(QString &filter)
Q_INVOKABLE void setNodeTypes(const QStringList &types)
Set node type filter that allows showing only data nodes of a certain type. Show all data nodes if em...
Q_INVOKABLE vtkIdType currentItem() const
void setShowCurrentItemParents(bool enable)
Q_INVOKABLE void setLevelFilter(QStringList &levelFilter)
Set level filter that allows showing only items at a specified level and their parents....
void currentItemChanged(vtkIdType)
QStringList includeNodeAttributeNamesFilter
Filter to show only items for data nodes that contain any of the given attributes with this name....
void setAlignPopupVertically(bool align)
Q_INVOKABLE vtkIdType rootItem() const
virtual Q_INVOKABLE vtkMRMLNode * currentNode() const
Convenience method to get the MRML data node corresponding to the selected item.
Q_INVOKABLE void addNodeAttributeFilter(QString attributeName, QVariant attributeValue=QString(), bool include=true, QString className=QString())
void setShowRootItem(bool show)
virtual void setCurrentItem(vtkIdType itemID)
Set current (=selected) subject hierarchy item.
Q_INVOKABLE void setHideChildNodeTypes(const QStringList &types)
virtual void setRootItem(vtkIdType itemID)
Set subject hierarchy item to be the root in the shown tree.
void setPluginWhitelist(QStringList allowlist)
Deprecated. Use setPluginAllowlist instead.
QStringList includeItemAttributeNamesFilter
Filter to show only items that contain any of the given attributes with this name....
Q_INVOKABLE qMRMLSubjectHierarchyModel * model() const
Q_INVOKABLE void removeItemAttributeFilter(QString attributeName, QVariant attributeValue, bool include)
Remove single item attribute filter specifying each attribute.
Q_INVOKABLE qMRMLSortFilterSubjectHierarchyProxyModel * sortFilterProxyModel() const
void setShowEmptyHierarchyItems(bool show)
Q_INVOKABLE void addItemAttributeFilter(QString attributeName, QVariant attributeValue=QString(), bool include=true)
void setMaximumNumberOfShownItems(int maxNumberOfShownItems)
int maximumNumberOfShownItems
Property determining the maximum number of items (rows) shown in the popup tree.
Item model for subject hierarchy.
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.
MRML node to represent a complete subject hierarchy tree.