Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLSpinBox.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 __qMRMLSpinBox_h
22 #define __qMRMLSpinBox_h
23 
24 // CTK includes
25 #include <ctkDoubleSpinBox.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 // qMRMLSpinBox includes
36 class qMRMLSpinBoxPrivate;
37 
55 class QMRML_WIDGETS_EXPORT qMRMLSpinBox : public ctkDoubleSpinBox
56 {
57  Q_OBJECT
58  QVTK_OBJECT
59 
63  // \sa setQuantity(), quantity()
64  // \sa setUnitAwareProperties(), unitAwareProperties()
65  Q_PROPERTY(QString quantity READ quantity WRITE setQuantity)
66 
67 
68  // \sa setUnitAwareProperties(), unitAwareProperties()
73  Q_FLAGS(UnitAwareProperty UnitAwareProperties)
74  Q_PROPERTY(UnitAwareProperties unitAwareProperties READ unitAwareProperties WRITE setUnitAwareProperties)
75 
76 public:
77  typedef ctkDoubleSpinBox Superclass;
78 
80  explicit qMRMLSpinBox(QWidget* parent = nullptr);
81  ~qMRMLSpinBox() 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  };
93  Q_DECLARE_FLAGS(UnitAwareProperties, UnitAwareProperty)
94 
95 
96  Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
98 
99  QString quantity()const;
100 
101  UnitAwareProperties unitAwareProperties()const;
102 
103 public slots:
104  void setQuantity(const QString& baseName);
105 
108  virtual void setMRMLScene(vtkMRMLScene* scene);
109 
110  void setUnitAwareProperties(UnitAwareProperties flags);
111 
112 protected slots:
113  void updateWidgetFromUnitNode();
114 
115 protected:
116  QScopedPointer<qMRMLSpinBoxPrivate> d_ptr;
117 
118 private:
119  Q_DECLARE_PRIVATE(qMRMLSpinBox);
120  Q_DISABLE_COPY(qMRMLSpinBox);
121 };
122 
123 Q_DECLARE_OPERATORS_FOR_FLAGS(qMRMLSpinBox::UnitAwareProperties)
124 
125 #endif
ctkDoubleSpinBox Superclass
Definition: qMRMLSpinBox.h:77
QScopedPointer< qMRMLSpinBoxPrivate > d_ptr
Definition: qMRMLSpinBox.h:116
Extend the ctkDoubleSpinBox to integrate units support.
Definition: qMRMLSpinBox.h:55
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