Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
qMRMLUnitWidget.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 __qMRMLUnitWidget_h
22#define __qMRMLUnitWidget_h
23
24// CTK includes
25#include <ctkVTKObject.h>
26
27// MRML includes
28class vtkMRMLNode;
29
30// qMRML includes
31#include <qMRMLWidget.h>
33
34// Qt includes
35class QWidget;
36
37// Unit includes
38#include "qSlicerUnitsModuleWidgetsExport.h"
39class qMRMLUnitWidgetPrivate;
41
42class Q_SLICER_MODULE_UNITS_WIDGETS_EXPORT qMRMLUnitWidget : public qMRMLWidget
43{
44 Q_OBJECT
45 QVTK_OBJECT
48 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
51 Q_PROPERTY(QString quantity READ quantity WRITE setQuantity NOTIFY quantityChanged)
54 Q_PROPERTY(QString prefix READ prefix WRITE setPrefix NOTIFY prefixChanged)
57 Q_PROPERTY(QString suffix READ suffix WRITE setSuffix NOTIFY suffixChanged)
60 Q_PROPERTY(int precision READ precision WRITE setPrecision NOTIFY precisionChanged)
63 Q_PROPERTY(double minimum READ minimum WRITE setMinimum NOTIFY minimumChanged)
66 Q_PROPERTY(double maximum READ maximum WRITE setMaximum NOTIFY maximumChanged)
69 Q_PROPERTY(double coefficient READ coefficient WRITE setCoefficient NOTIFY coefficientChanged)
72 Q_PROPERTY(double offset READ offset WRITE setOffset NOTIFY offsetChanged)
73
82 Q_PROPERTY(UnitProperties editableProperties READ editableProperties WRITE setEditableProperties)
83
84 Q_FLAGS(UnitProperty UnitProperties)
85
86public:
88 qMRMLUnitWidget(QWidget* parent = nullptr);
89 ~qMRMLUnitWidget() override;
90
93 QString name() const;
96 QString quantity() const;
99 QString prefix() const;
102 QString suffix() const;
105 int precision() const;
108 double minimum() const;
111 double maximum() const;
114 double coefficient() const;
117 double offset() const;
118
120 {
121 None = 0x000,
122 Preset = 0x001,
123 Name = 0x002,
124 Quantity = 0x004,
125 Precision = 0x008,
126 Prefix = 0x010,
127 Suffix = 0x020,
128 Minimum = 0x040,
129 Maximum = 0x080,
130 Coefficient = 0x100,
131 Offset = 0x200,
132 All = 0xfff,
133 };
134 Q_DECLARE_FLAGS(UnitProperties, UnitProperty)
135
136
138 UnitProperties displayedProperties() const;
141 UnitProperties editableProperties() const;
142
144 void setMRMLScene(vtkMRMLScene* unitsLogicScene) override;
145
146 Q_INVOKABLE vtkMRMLNode* currentNode() const;
147
148public slots:
150
153 void setName(const QString&);
156 void setQuantity(const QString&);
159 void setPrefix(const QString&);
162 void setSuffix(const QString&);
165 void setPrecision(int);
168 void setMinimum(double);
171 void setMaximum(double);
174 void setCoefficient(double);
177 void setOffset(double);
178
181
184 void setDisplayedProperties(UnitProperties properties);
187 void setEditableProperties(UnitProperties properties);
188
189protected slots:
191
192signals:
193 void nameChanged(QString);
194 void quantityChanged(QString);
195 void prefixChanged(QString);
196 void suffixChanged(QString);
198 void minimumChanged(double);
199 void maximumChanged(double);
200 void coefficientChanged(double);
201 void offsetChanged(double);
202
203protected:
204 QScopedPointer<qMRMLUnitWidgetPrivate> d_ptr;
205
206private:
207 Q_DECLARE_PRIVATE(qMRMLUnitWidget);
208 Q_DISABLE_COPY(qMRMLUnitWidget);
209};
210
211Q_DECLARE_OPERATORS_FOR_FLAGS(qMRMLUnitWidget::UnitProperties)
212
213#endif
Combobox that automatically displays all the nodes of the scene that match filtering criteria.
void suffixChanged(QString)
void coefficientChanged(double)
UnitProperties editableProperties
void setEditableProperties(UnitProperties properties)
void setDisplayedProperties(UnitProperties properties)
qMRMLWidget Superclass
qMRMLUnitWidget(QWidget *parent=nullptr)
void minimumChanged(double)
Q_INVOKABLE vtkMRMLNode * currentNode() const
void quantityChanged(QString)
void setPrecision(int)
QVTK_OBJECTQString name
void setPrefix(const QString &)
void precisionChanged(int)
void setName(const QString &)
void setMinimum(double)
void setQuantity(const QString &)
void setUnitFromPreset(vtkMRMLNode *presetNode)
Apply a preset to the node.
void maximumChanged(double)
void setSuffix(const QString &)
QScopedPointer< qMRMLUnitWidgetPrivate > d_ptr
void updateWidgetFromNode()
void setCoefficient(double)
void setMaximum(double)
void setOffset(double)
void setCurrentNode(vtkMRMLNode *unitNode)
void offsetChanged(double)
UnitProperties displayedProperties
void prefixChanged(QString)
void nameChanged(QString)
void setMRMLScene(vtkMRMLScene *unitsLogicScene) override
Set the units logic scene for the preset comboboxes.
qMRMLWidget(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.
Slicer logic for unit manipulation.