Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLSliderWidget.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Johan Andruejol, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qMRMLSliderWidget_h
22 #define __qMRMLSliderWidget_h
23 
24 // CTK includes
25 #include <ctkSliderWidget.h>
26 #include <ctkVTKObject.h>
27 
28 // qMRML includes
29 #include <qMRMLWidgetsExport.h>
30 
31 // VTK includes
32 class vtkMRMLNode;
33 class vtkMRMLScene;
34 
35 // qMRMLSliderWidget includes
36 class qMRMLSliderWidgetPrivate;
37 
55 class QMRML_WIDGETS_EXPORT qMRMLSliderWidget : public ctkSliderWidget
56 {
57  Q_OBJECT
58  QVTK_OBJECT
59 
63  // \sa setQuantity(), quantity()
64  Q_PROPERTY(QString quantity READ quantity WRITE setQuantity)
65 
66 
67  // \sa setUnitAwareProperties(), unitAwareProperties()
73  Q_FLAGS(UnitAwareProperty UnitAwareProperties)
74  Q_PROPERTY(UnitAwareProperties unitAwareProperties READ unitAwareProperties WRITE setUnitAwareProperties)
75 
76 public:
77  typedef ctkSliderWidget Superclass;
78 
80  explicit qMRMLSliderWidget(QWidget* parent = nullptr);
81  ~qMRMLSliderWidget() override;
82 
84  {
85  None = 0x00,
86  Prefix = 0x01,
87  Suffix = 0x02,
88  Precision = 0x04,
89  MinimumValue = 0x08,
90  MaximumValue = 0x10,
91  Scaling = 0x20,
92  All = Prefix | Suffix | Precision | MinimumValue | MaximumValue | Scaling
93  };
94  Q_DECLARE_FLAGS(UnitAwareProperties, UnitAwareProperty)
95 
96 
97  Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
99 
102  QString quantity()const;
103 
106  UnitAwareProperties unitAwareProperties()const;
107 
111  void setMinimum(double) override;
112  void setMaximum(double) override;
113  void setRange(double, double) override;
114 
115 public slots:
116  void setQuantity(const QString& baseName);
117 
120  virtual void setMRMLScene(vtkMRMLScene* scene);
121 
122  void setUnitAwareProperties(UnitAwareProperties flags);
123 
124 protected slots:
125  void updateWidgetFromUnitNode();
126 
127 protected:
128  QScopedPointer<qMRMLSliderWidgetPrivate> d_ptr;
129 
130 private:
131  Q_DECLARE_PRIVATE(qMRMLSliderWidget);
132  Q_DISABLE_COPY(qMRMLSliderWidget);
133 };
134 
135 Q_DECLARE_OPERATORS_FOR_FLAGS(qMRMLSliderWidget::UnitAwareProperties)
136 
137 #endif
QScopedPointer< qMRMLSliderWidgetPrivate > d_ptr
Extend the ctkSliderWidget to integrate units support.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
ctkSliderWidget Superclass