Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
98public:
99 typedef ctkComboBox Superclass;
100 qMRMLSubjectHierarchyComboBox(QWidget *parent=nullptr);
102
103public:
104 Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
106
107 Q_INVOKABLE void clearSelection();
108 Q_INVOKABLE vtkIdType currentItem()const;
109 Q_INVOKABLE vtkIdType rootItem()const;
110
111 void setShowRootItem(bool show);
112 bool showRootItem()const;
113
115 void setHighlightReferencedItems(bool highlightOn);
116
118 void setMaximumNumberOfShownItems(int maxNumberOfShownItems);
119
121 void setAlignPopupVertically(bool align);
122
123 bool noneEnabled()const;
124 void setNoneEnabled(bool enable);
125
126 QString noneDisplay()const;
127 void setNoneDisplay(const QString& displayName);
128
130 void setShowCurrentItemParents(bool enable);
131
134
139 QString attributeValueFilter()const;
140 QString attributeNameFilter()const;
148 Q_INVOKABLE void addItemAttributeFilter(QString attributeName, QVariant attributeValue=QString(), bool include=true);
150 Q_INVOKABLE void removeItemAttributeFilter(QString attributeName, QVariant attributeValue, bool include);
152 Q_INVOKABLE void removeItemAttributeFilter(QString attributeName, bool include);
161 Q_INVOKABLE void addNodeAttributeFilter(QString attributeName, QVariant attributeValue=QString(), bool include=true, QString className=QString());
163 Q_INVOKABLE void removeNodeAttributeFilter(QString attributeName, QVariant attributeValue, bool include, QString className);
165 Q_INVOKABLE void removeNodeAttributeFilter(QString attributeName, bool include);
166
167
169 Q_INVOKABLE void setLevelFilter(QStringList &levelFilter);
171 Q_INVOKABLE void setNodeTypes(const QStringList& types);
174 Q_INVOKABLE void setHideChildNodeTypes(const QStringList& types);
175
178
179public:
181 void showPopup() override;
182
183public slots:
185 virtual void setMRMLScene(vtkMRMLScene* scene);
186
188 virtual void setCurrentItem(vtkIdType itemID);
189
191 virtual void setRootItem(vtkIdType itemID);
192
196 void setPluginAllowlist(QStringList allowlist);
200 void setPluginBlocklist(QStringList blocklist);
203 void disablePlugin(QString plugin);
204
206 void setPluginWhitelist(QStringList allowlist)
207 {
208 qWarning("qMRMLSubjectHierarchyComboBox::setPluginWhitelist is deprecated. Use setPluginAllowlist instead.");
209 this->setPluginAllowlist(allowlist);
210 }
211
212 void setPluginBlacklist(QStringList blocklist)
213 {
214 qWarning("qMRMLSubjectHierarchyComboBox::setPluginBlacklist is deprecated. Use setPluginBlocklist instead.");
215 this->setPluginBlocklist(blocklist);
216 }
217
218 void setIncludeItemAttributeNamesFilter(QStringList filter);
219 void setIncludeNodeAttributeNamesFilter(QStringList filter);
220 void setExcludeItemAttributeNamesFilter(QStringList filter);
221 void setExcludeNodeAttributeNamesFilter(QStringList filter);
222 void setAttributeNameFilter(QString& filter);
223 void setAttributeValueFilter(QString& filter);
224
225signals:
226 void currentItemChanged(vtkIdType);
227 void currentItemModified(vtkIdType);
228
229protected slots:
230 void updateComboBoxTitleAndIcon(vtkIdType selectedShItemID);
231
232 void hidePopup() override;
233
234 virtual void onMRMLSceneCloseEnded(vtkObject* sceneObject);
235
236protected:
238 void mousePressEvent(QMouseEvent* event) override;
239
240protected:
241 QScopedPointer<qMRMLSubjectHierarchyComboBoxPrivate> d_ptr;
242
243private:
244 Q_DECLARE_PRIVATE(qMRMLSubjectHierarchyComboBox);
245 Q_DISABLE_COPY(qMRMLSubjectHierarchyComboBox);
246};
247
248#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)
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
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.
A set of MRML Nodes that supports serialization and undo/redo.
MRML node to represent a complete subject hierarchy tree.