Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkNumberPropertyView.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 #ifndef QmitkNumberPropertyView_h
13 #define QmitkNumberPropertyView_h
14 
16 #include <QLabel>
17 #include <mitkProperties.h>
18 #include <mitkPropertyObserver.h>
19 
31 {
32  Q_OBJECT
33  Q_PROPERTY(short decimalPlaces READ decimalPlaces WRITE setDecimalPlaces)
34  Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
35  Q_PROPERTY(bool showPercent READ showPercent WRITE setShowPercent)
36 
37 public:
43  QmitkNumberPropertyView(const mitk::IntProperty *property, QWidget *parent);
44 
50  QmitkNumberPropertyView(const mitk::FloatProperty *property, QWidget *parent);
51 
57  QmitkNumberPropertyView(const mitk::DoubleProperty *property, QWidget *parent);
58 
61 
66  short decimalPlaces() const;
67 
72  void setDecimalPlaces(short places);
73 
78  QString suffix() const;
79 
84  void setSuffix(const QString &suffix);
85 
90  bool showPercent() const;
91 
96  void setShowPercent(bool show);
97 
98 protected:
99  void initialize();
100 
101  void PropertyChanged() override;
102  void PropertyRemoved() override;
103 
105 
106  union {
110  };
111 
112  const int m_DataType;
113 
115  QString m_Suffix;
117 };
118 
119 #endif
#define MITKQTWIDGETSEXT_EXPORT
Read-only QLabel that displays a numeric MITK property value.
void PropertyChanged() override
Called when the observed property value has changed.
const mitk::GenericProperty< int > * m_IntProperty
~QmitkNumberPropertyView() override
Destructor.
const mitk::GenericProperty< double > * m_DoubleProperty
bool showPercent() const
Check whether values are displayed as percentages.
QString m_Suffix
-1 indicates "no limit to decimal places"
void setDecimalPlaces(short places)
Set the number of decimal places to display.
void setShowPercent(bool show)
Enable or disable percentage display (value multiplied by 100, "%" suffix).
const mitk::GenericProperty< float > * m_FloatProperty
QString suffix() const
Get the current text suffix.
QmitkNumberPropertyView(const mitk::IntProperty *property, QWidget *parent)
Construct a view for an integer property.
void setSuffix(const QString &suffix)
Set a text suffix appended to the displayed value.
void PropertyRemoved() override
Called when the observed property is about to be deleted.
QmitkNumberPropertyView(const mitk::FloatProperty *property, QWidget *parent)
Construct a view for a float property.
QmitkNumberPropertyView(const mitk::DoubleProperty *property, QWidget *parent)
Construct a view for a double property.
short decimalPlaces() const
Get the number of decimal places displayed.
Read-only observer for a mitk::BaseProperty.
Declares commonly used GenericProperty specializations for MITK.