CCIMXDesktop
 
Loading...
Searching...
No Matches
FloatSlideBar.h
1#ifndef FLOATSLIDEBAR_H
2#define FLOATSLIDEBAR_H
3
4#include <QSlider>
5
10class FloatSlider : public QSlider {
11 Q_OBJECT
12
14 static constexpr float MIN = 0.0;
15
17 static constexpr float MAX = 100.0;
18
20 static constexpr int PRE = 1000;
21
22public:
28 explicit FloatSlider(Qt::Orientation orientation, QWidget* parent = nullptr);
29
35 void setFloatRange(double min, double max);
36
41 void setFloatValue(double val);
42
47 double floatValue() const;
48
49signals:
54 void floatValueChanged(double val);
55
56private slots:
61 void onIntValueChanged(int value);
62
63private:
67 void updateSliderValue();
68
70 double current_min { MIN };
71
73 double current_max { MAX };
74
76 int precision { PRE };
77};
78
79#endif // FLOATSLIDEBAR_H
The FloatSlider class A QSlider subclass that allows working with floating point ranges and values.
Definition FloatSlideBar.h:10
void setFloatRange(double min, double max)
Set the floating point range for the slider.
Definition FloatSlideBar.cpp:10
void setFloatValue(double val)
Set the current floating point value.
Definition FloatSlideBar.cpp:16
double floatValue() const
Get the current floating point value.
Definition FloatSlideBar.cpp:26
void floatValueChanged(double val)
Signal emitted when the float value changes.