Slicer  5.1
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 #include <ctkVTKObject.h>
29 
30 // SubjectHierarchy includes
31 #include "qSlicerSubjectHierarchyModuleWidgetsExport.h"
32 
34 
35 class qMRMLSubjectHierarchyComboBoxPrivate;
38 class vtkMRMLScene;
39 
41 class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qMRMLSubjectHierarchyComboBox : public ctkComboBox
42 {
43  Q_OBJECT
44  QVTK_OBJECT
45 
50  Q_PROPERTY(bool showRootItem READ showRootItem WRITE setShowRootItem)
54  Q_PROPERTY(bool highlightReferencedItems READ highlightReferencedItems WRITE setHighlightReferencedItems)
56  Q_PROPERTY(int maximumNumberOfShownItems READ maximumNumberOfShownItems WRITE setMaximumNumberOfShownItems)
60  Q_PROPERTY(bool alignPopupVertically READ alignPopupVertically WRITE setAlignPopupVertically)
63  Q_PROPERTY(bool noneEnabled READ noneEnabled WRITE setNoneEnabled)
67  Q_PROPERTY(QString noneDisplay READ noneDisplay WRITE setNoneDisplay)
71  Q_PROPERTY(bool showCurrentItemParents READ showCurrentItemParents WRITE setShowCurrentItemParents)
76  Q_PROPERTY(bool showEmptyHierarchyItems READ showEmptyHierarchyItems WRITE setShowEmptyHierarchyItems)
77 
79  Q_PROPERTY(QStringList includeItemAttributeNamesFilter READ includeItemAttributeNamesFilter WRITE setIncludeItemAttributeNamesFilter)
81  Q_PROPERTY(QStringList includeNodeAttributeNamesFilter READ includeNodeAttributeNamesFilter WRITE setIncludeNodeAttributeNamesFilter)
84  Q_PROPERTY(QStringList excludeItemAttributeNamesFilter READ excludeItemAttributeNamesFilter WRITE setExcludeItemAttributeNamesFilter)
87  Q_PROPERTY(QStringList excludeNodeAttributeNamesFilter READ excludeNodeAttributeNamesFilter WRITE setExcludeNodeAttributeNamesFilter)
88 
91  Q_PROPERTY(QString attributeNameFilter READ attributeNameFilter WRITE setAttributeNameFilter)
96  Q_PROPERTY(QString attributeValueFilter READ attributeValueFilter WRITE setAttributeValueFilter)
97 
98 public:
99  typedef ctkComboBox Superclass;
100  qMRMLSubjectHierarchyComboBox(QWidget *parent=nullptr);
101  ~qMRMLSubjectHierarchyComboBox() override;
102 
103 public:
104  Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
105  Q_INVOKABLE vtkMRMLSubjectHierarchyNode* subjectHierarchyNode()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 
114  bool highlightReferencedItems()const;
115  void setHighlightReferencedItems(bool highlightOn);
116 
117  int maximumNumberOfShownItems()const;
118  void setMaximumNumberOfShownItems(int maxNumberOfShownItems);
119 
120  bool alignPopupVertically()const;
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 
129  bool showCurrentItemParents()const;
130  void setShowCurrentItemParents(bool enable);
131 
132  bool showEmptyHierarchyItems()const;
133  void setShowEmptyHierarchyItems(bool show);
134 
135  QStringList includeItemAttributeNamesFilter()const;
136  QStringList includeNodeAttributeNamesFilter()const;
137  QStringList excludeItemAttributeNamesFilter()const;
138  QStringList excludeNodeAttributeNamesFilter()const;
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 
176  Q_INVOKABLE qMRMLSortFilterSubjectHierarchyProxyModel* sortFilterProxyModel()const;
177  Q_INVOKABLE qMRMLSubjectHierarchyModel* model()const;
178 
179 public:
181  void showPopup() override;
182 
183 public slots:
185  virtual void setMRMLScene(vtkMRMLScene* scene);
186 
188  virtual void setCurrentItem(vtkIdType itemID);
189 
191  virtual void setRootItem(vtkIdType itemID);
192 
196  void setPluginWhitelist(QStringList whitelist);
200  void setPluginBlacklist(QStringList blacklist);
203  void disablePlugin(QString plugin);
204 
205  void setIncludeItemAttributeNamesFilter(QStringList filter);
206  void setIncludeNodeAttributeNamesFilter(QStringList filter);
207  void setExcludeItemAttributeNamesFilter(QStringList filter);
208  void setExcludeNodeAttributeNamesFilter(QStringList filter);
209  void setAttributeNameFilter(QString& filter);
210  void setAttributeValueFilter(QString& filter);
211 
212 signals:
213  void currentItemChanged(vtkIdType);
214  void currentItemModified(vtkIdType);
215 
216 protected slots:
217  void updateComboBoxTitleAndIcon(vtkIdType selectedShItemID);
218 
219  void hidePopup() override;
220 
221  virtual void onMRMLSceneCloseEnded(vtkObject* sceneObject);
222 
223 protected:
225  void mousePressEvent(QMouseEvent* event) override;
226 
227 protected:
228  QScopedPointer<qMRMLSubjectHierarchyComboBoxPrivate> d_ptr;
229 
230 private:
231  Q_DECLARE_PRIVATE(qMRMLSubjectHierarchyComboBox);
232  Q_DISABLE_COPY(qMRMLSubjectHierarchyComboBox);
233 };
234 
235 #endif
MRML node to represent a complete subject hierarchy tree.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
Item model for subject hierarchy.