Slicer  4.8
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 
60 public:
61  typedef ctkComboBox Superclass;
62  qMRMLSubjectHierarchyComboBox(QWidget *parent=0);
64 
65 public:
66  Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
67  Q_INVOKABLE vtkMRMLSubjectHierarchyNode* subjectHierarchyNode()const;
68 
69  Q_INVOKABLE void clearSelection();
70  Q_INVOKABLE vtkIdType currentItem()const;
71  Q_INVOKABLE vtkIdType rootItem()const;
72 
73  void setShowRootItem(bool show);
74  bool showRootItem()const;
75 
76  bool highlightReferencedItems()const;
77  void setHighlightReferencedItems(bool highlightOn);
78 
79  int maximumNumberOfShownItems()const;
80  void setMaximumNumberOfShownItems(int maxNumberOfShownItems);
81 
82  bool alignPopupVertically()const;
83  void setAlignPopupVertically(bool align);
84 
89  Q_INVOKABLE void setAttributeFilter(const QString& attributeName, const QVariant& attributeValue=QVariant());
91  Q_INVOKABLE void removeAttributeFilter();
92 
94  Q_INVOKABLE void setLevelFilter(QString &levelFilter);
95 
96  Q_INVOKABLE qMRMLSortFilterSubjectHierarchyProxyModel* sortFilterProxyModel()const;
97  Q_INVOKABLE qMRMLSubjectHierarchyModel* model()const;
98 
99 public:
101  virtual void showPopup();
102 
103 public slots:
105  virtual void setMRMLScene(vtkMRMLScene* scene);
106 
108  virtual void setCurrentItem(vtkIdType itemID);
109 
111  virtual void setRootItem(vtkIdType itemID);
112 
113 signals:
114  void currentItemChanged(vtkIdType);
115  void currentItemModified(vtkIdType);
116 
117 protected slots:
118  void updateComboBoxTitleAndIcon(vtkIdType selectedShItemID);
119 
120 protected:
122  virtual void mousePressEvent(QMouseEvent* event);
123 
124 protected:
125  QScopedPointer<qMRMLSubjectHierarchyComboBoxPrivate> d_ptr;
126 
127 private:
128  Q_DECLARE_PRIVATE(qMRMLSubjectHierarchyComboBox);
129  Q_DISABLE_COPY(qMRMLSubjectHierarchyComboBox);
130 };
131 
132 #endif
MRML node to represent a complete subject hierarchy tree.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
Item model for subject hierarchy.