Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkNumberPropertySlider.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 QmitkNumberPropertySlider_h
13 #define QmitkNumberPropertySlider_h
14 
16 
17 #include <QSlider>
18 
19 #include <memory>
20 
21 namespace mitk
22 {
23  class IntProperty;
24  class FloatProperty;
25  class DoubleProperty;
26 }
27 
39 {
40  Q_OBJECT
41  Q_PROPERTY(short decimalPlaces READ getDecimalPlaces WRITE setDecimalPlaces)
42  Q_PROPERTY(bool showPercent READ getShowPercent WRITE setShowPercent)
43  Q_PROPERTY(int minValue READ minValue WRITE setMinValue)
44  Q_PROPERTY(int maxValue READ maxValue WRITE setMaxValue)
45 
46 public:
51  QmitkNumberPropertySlider(QWidget *parent = nullptr);
52 
55 
60  void SetProperty(mitk::IntProperty *property);
61 
66  void SetProperty(mitk::FloatProperty *property);
67 
72  void SetProperty(mitk::DoubleProperty *property);
73 
78  short getDecimalPlaces() const;
79 
84  void setDecimalPlaces(short places);
85 
90  bool getShowPercent() const;
91 
96  void setShowPercent(bool showPercent);
97 
102  int minValue() const;
103 
108  void setMinValue(int value);
109 
114  int maxValue() const;
115 
120  void setMaxValue(int value);
121 
126  double doubleValue() const;
127 
132  void setDoubleValue(double value);
133 
134 protected slots:
135 
136  void onValueChanged(int);
137 
138 private:
139  class Impl;
140  std::unique_ptr<Impl> d;
141 };
142 
143 #endif
#define MITKQTWIDGETSEXT_EXPORT
A QSlider that edits numeric MITK properties (int, float, double).
QmitkNumberPropertySlider(QWidget *parent=nullptr)
Construct the slider without an associated property.
int minValue() const
Get the minimum allowed value.
void SetProperty(mitk::FloatProperty *property)
Bind this slider to a float property.
void setDoubleValue(double value)
Set the current value from a double.
short getDecimalPlaces() const
Get the number of decimal places used for conversion.
double doubleValue() const
Get the current value as a double.
void setMinValue(int value)
Set the minimum allowed value.
void setMaxValue(int value)
Set the maximum allowed value.
~QmitkNumberPropertySlider() override
Destructor.
void setDecimalPlaces(short places)
Set the number of decimal places (only effective for float/double properties).
int maxValue() const
Get the maximum allowed value.
void SetProperty(mitk::IntProperty *property)
Bind this slider to an integer property.
void SetProperty(mitk::DoubleProperty *property)
Bind this slider to a double property.
void setShowPercent(bool showPercent)
Enable or disable percentage mode.
bool getShowPercent() const
Check whether values are interpreted as percentages.
Find image slices visible on a given plane.