Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLCoordinatesWidget.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 __qMRMLCoordinatesWidget_h
22 #define __qMRMLCoordinatesWidget_h
23 
24 // Qt includes
25 class QWidget;
26 
27 // CTK includes
28 #include <ctkCoordinatesWidget.h>
29 #include <ctkVTKObject.h>
30 
31 // qMRML includes
32 #include "qMRMLWidgetsExport.h"
33 
34 // VTK includes
35 class vtkMRMLNode;
36 class vtkMRMLScene;
37 
38 // qMRMLSpinBox includes
39 class qMRMLCoordinatesWidgetPrivate;
40 
53 //
58 class QMRML_WIDGETS_EXPORT qMRMLCoordinatesWidget : public ctkCoordinatesWidget
59 {
60  Q_OBJECT
61  QVTK_OBJECT
62 
66  // \sa setQuantity(), quantity()
67  Q_PROPERTY(QString quantity READ quantity WRITE setQuantity NOTIFY quantityChanged)
68 
69 
70  // \sa setUnitAwareProperties(), unitAwareProperties()
75  Q_FLAGS(UnitAwareProperty UnitAwareProperties)
76  Q_PROPERTY(UnitAwareProperties unitAwareProperties READ unitAwareProperties WRITE setUnitAwareProperties)
77 
78 public:
79  typedef ctkCoordinatesWidget Superclass;
80 
82  explicit qMRMLCoordinatesWidget(QWidget* parent = nullptr);
83  ~qMRMLCoordinatesWidget() override;
84 
86  {
87  None = 0x00,
88  Prefix = 0x01,
89  Suffix = 0x02,
90  Precision = 0x04,
91  MinimumValue = 0x08,
92  MaximumValue = 0x10,
93  Scaling = 0x20,
94  All = Prefix | Suffix | Precision | MinimumValue | MaximumValue | Scaling
95  };
96  Q_DECLARE_FLAGS(UnitAwareProperties, UnitAwareProperty)
97 
98 
99  Q_INVOKABLE vtkMRMLScene* mrmlScene() const;
101 
102  QString quantity() const;
103 
104  UnitAwareProperties unitAwareProperties()const;
105 
106 public slots:
107  void setQuantity(const QString& baseName);
108 
111  virtual void setMRMLScene(vtkMRMLScene* scene);
112 
113  void setUnitAwareProperties(UnitAwareProperties flags);
114 
115 signals:
116  void mrmlSceneChanged(vtkMRMLScene*);
117  void quantityChanged(const QString&);
118 
119 protected slots:
120  void updateWidgetFromUnitNode();
121 
122 protected:
123  QScopedPointer<qMRMLCoordinatesWidgetPrivate> d_ptr;
124 
125 private:
126  Q_DECLARE_PRIVATE(qMRMLCoordinatesWidget);
127  Q_DISABLE_COPY(qMRMLCoordinatesWidget);
128 };
129 
130 Q_DECLARE_OPERATORS_FOR_FLAGS(qMRMLCoordinatesWidget::UnitAwareProperties)
131 
132 #endif
QScopedPointer< qMRMLCoordinatesWidgetPrivate > d_ptr
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
Extend the ctkCoordinatesWidget to integrate units support.
ctkCoordinatesWidget Superclass
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167