Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
32class vtkMRMLNode;
33class vtkMRMLScene;
34
35// qMRMLSpinBox includes
36class qMRMLSpinBoxPrivate;
37
55class 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
72 // \sa setUnitAwareProperties(), unitAwareProperties()
73 Q_FLAGS(UnitAwareProperty UnitAwareProperties)
74 Q_PROPERTY(UnitAwareProperties unitAwareProperties READ unitAwareProperties WRITE setUnitAwareProperties)
75
76public:
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,
91 Scaling = 0x20,
92 };
93 Q_DECLARE_FLAGS(UnitAwareProperties, UnitAwareProperty)
94
95
97 Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
98
99 QString quantity()const;
100
101 UnitAwareProperties unitAwareProperties()const;
102
103public slots:
104 void setQuantity(const QString& baseName);
105
108 virtual void setMRMLScene(vtkMRMLScene* scene);
109
110 void setUnitAwareProperties(UnitAwareProperties flags);
111
112protected slots:
114
115protected:
116 QScopedPointer<qMRMLSpinBoxPrivate> d_ptr;
117
118private:
119 Q_DECLARE_PRIVATE(qMRMLSpinBox);
120 Q_DISABLE_COPY(qMRMLSpinBox);
121};
122
123Q_DECLARE_OPERATORS_FOR_FLAGS(qMRMLSpinBox::UnitAwareProperties)
124
125#endif
UnitAwareProperties unitAwareProperties
qMRMLSpinBox(QWidget *parent=nullptr)
Construct an empty qMRMLSpinBox with a null scene.
QVTK_OBJECTQString quantity
Q_INVOKABLE vtkMRMLScene * mrmlScene() const
QScopedPointer< qMRMLSpinBoxPrivate > d_ptr
void setQuantity(const QString &baseName)
void setUnitAwareProperties(UnitAwareProperties flags)
virtual void setMRMLScene(vtkMRMLScene *scene)
ctkDoubleSpinBox Superclass
void updateWidgetFromUnitNode()
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.