Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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 
29 // SubjectHierarchy includes
30 #include "qSlicerSubjectHierarchyModuleWidgetsExport.h"
31 
33 
34 class qMRMLSubjectHierarchyComboBoxPrivate;
37 class vtkMRMLScene;
38 
40 class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qMRMLSubjectHierarchyComboBox : public ctkComboBox
41 {
42  Q_OBJECT
43 
48  Q_PROPERTY(bool showRootItem READ showRootItem WRITE setShowRootItem)
52  Q_PROPERTY(bool highlightReferencedItems READ highlightReferencedItems WRITE setHighlightReferencedItems)
54  Q_PROPERTY(int maximumNumberOfShownItems READ maximumNumberOfShownItems WRITE setMaximumNumberOfShownItems)
58  Q_PROPERTY(bool alignPopupVertically READ alignPopupVertically WRITE setAlignPopupVertically)
59 
61  Q_PROPERTY(QStringList includeItemAttributeNamesFilter READ includeItemAttributeNamesFilter WRITE setIncludeItemAttributeNamesFilter)
63  Q_PROPERTY(QStringList includeNodeAttributeNamesFilter READ includeNodeAttributeNamesFilter WRITE setIncludeNodeAttributeNamesFilter)
66  Q_PROPERTY(QStringList excludeItemAttributeNamesFilter READ excludeItemAttributeNamesFilter WRITE setExcludeItemAttributeNamesFilter)
69  Q_PROPERTY(QStringList excludeNodeAttributeNamesFilter READ excludeNodeAttributeNamesFilter WRITE setExcludeNodeAttributeNamesFilter)
70 
73  Q_PROPERTY(QString attributeNameFilter READ attributeNameFilter WRITE setAttributeNameFilter)
78  Q_PROPERTY(QString attributeValueFilter READ attributeValueFilter WRITE setAttributeValueFilter)
79 
80 public:
81  typedef ctkComboBox Superclass;
82  qMRMLSubjectHierarchyComboBox(QWidget *parent=nullptr);
84 
85 public:
86  Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
87  Q_INVOKABLE vtkMRMLSubjectHierarchyNode* subjectHierarchyNode()const;
88 
89  Q_INVOKABLE void clearSelection();
90  Q_INVOKABLE vtkIdType currentItem()const;
91  Q_INVOKABLE vtkIdType rootItem()const;
92 
93  void setShowRootItem(bool show);
94  bool showRootItem()const;
95 
96  bool highlightReferencedItems()const;
97  void setHighlightReferencedItems(bool highlightOn);
98 
99  int maximumNumberOfShownItems()const;
100  void setMaximumNumberOfShownItems(int maxNumberOfShownItems);
101 
102  bool alignPopupVertically()const;
103  void setAlignPopupVertically(bool align);
104 
105  QStringList includeItemAttributeNamesFilter()const;
106  QStringList includeNodeAttributeNamesFilter()const;
107  QStringList excludeItemAttributeNamesFilter()const;
108  QStringList excludeNodeAttributeNamesFilter()const;
109  QString attributeValueFilter()const;
110  QString attributeNameFilter()const;
118  Q_INVOKABLE void addItemAttributeFilter(QString attributeName, QVariant attributeValue=QString(), bool include=true);
120  Q_INVOKABLE void removeItemAttributeFilter(QString attributeName, QVariant attributeValue, bool include);
122  Q_INVOKABLE void removeItemAttributeFilter(QString attributeName, bool include);
131  Q_INVOKABLE void addNodeAttributeFilter(QString attributeName, QVariant attributeValue=QString(), bool include=true, QString className=QString());
133  Q_INVOKABLE void removeNodeAttributeFilter(QString attributeName, QVariant attributeValue, bool include, QString className);
135  Q_INVOKABLE void removeNodeAttributeFilter(QString attributeName, bool include);
136 
137 
139  Q_INVOKABLE void setLevelFilter(QStringList &levelFilter);
141  Q_INVOKABLE void setNodeTypes(const QStringList& types);
144  Q_INVOKABLE void setHideChildNodeTypes(const QStringList& types);
145 
146  Q_INVOKABLE qMRMLSortFilterSubjectHierarchyProxyModel* sortFilterProxyModel()const;
147  Q_INVOKABLE qMRMLSubjectHierarchyModel* model()const;
148 
149 public:
151  void showPopup() override;
152 
153 public slots:
155  virtual void setMRMLScene(vtkMRMLScene* scene);
156 
158  virtual void setCurrentItem(vtkIdType itemID);
159 
161  virtual void setRootItem(vtkIdType itemID);
162 
166  void setPluginWhitelist(QStringList whitelist);
170  void setPluginBlacklist(QStringList blacklist);
173  void disablePlugin(QString plugin);
174 
175  void setIncludeItemAttributeNamesFilter(QStringList filter);
176  void setIncludeNodeAttributeNamesFilter(QStringList filter);
177  void setExcludeItemAttributeNamesFilter(QStringList filter);
178  void setExcludeNodeAttributeNamesFilter(QStringList filter);
179  void setAttributeNameFilter(QString& filter);
180  void setAttributeValueFilter(QString& filter);
181 
182 signals:
183  void currentItemChanged(vtkIdType);
184  void currentItemModified(vtkIdType);
185 
186 protected slots:
187  void updateComboBoxTitleAndIcon(vtkIdType selectedShItemID);
188 
189 protected:
191  void mousePressEvent(QMouseEvent* event) override;
192 
193 protected:
194  QScopedPointer<qMRMLSubjectHierarchyComboBoxPrivate> d_ptr;
195 
196 private:
197  Q_DECLARE_PRIVATE(qMRMLSubjectHierarchyComboBox);
198  Q_DISABLE_COPY(qMRMLSubjectHierarchyComboBox);
199 };
200 
201 #endif
MRML node to represent a complete subject hierarchy tree.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:61
Item model for subject hierarchy.