NDEVR
API Documentation
QCustomSlider.h
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/BaseValues.h>
4#include <QSlider>
5namespace NDEVR
6{
13 class NDEVR_WIDGETS_API QCustomSlider : public QSlider
14 {
15 Q_OBJECT
16 public:
22 QCustomSlider(Qt::Orientation orientation, QWidget* parent = nullptr)
23 : QSlider(orientation, parent)
24 {
25 init();
26 }
27
31 QCustomSlider(QWidget* parent = nullptr)
32 : QSlider(parent)
33 {
34 init();
35 }
36
41 {
42 return cast<fltp08>(value()) / sliderScale();
43 }
44
48 void setValue(fltp08 value)
49 {
50 QSlider::setValue(cast<int>(value * sliderScale()));
51 }
52
56 void setMaximum(fltp08 value)
57 {
58 QSlider::setMaximum(cast<int>(value * sliderScale()));
59 }
60
64 void setMinimum(fltp08 value)
65 {
66 QSlider::setMinimum(cast<int>(value * sliderScale()));
67 }
68
73 void setRange(fltp08 min, fltp08 max);
78 void setVertical(bool is_vertical);
79 protected:
86 {
87 fltp08 value = 100.0;
88 return value;
89 }
90
93 void init();
94 protected slots:
99 signals:
104 void edited(fltp08 percent);
109 };
110}
fltp08 sliderScale() const
Returns the internal scale factor used to convert between floating-point values and the integer-based...
void setMinimum(fltp08 value)
Sets the minimum slider value from a floating-point value.
void init()
Initializes the slider with default settings and signal connections.
void setValue(fltp08 value)
Sets the slider value from a floating-point percent.
QCustomSlider(QWidget *parent=nullptr)
Constructs a slider with default orientation.
void setRange(fltp08 min, fltp08 max)
Sets the minimum and maximum range of the slider.
QCustomSlider(Qt::Orientation orientation, QWidget *parent=nullptr)
Constructs a slider with the specified orientation.
void setMaximum(fltp08 value)
Sets the maximum slider value from a floating-point value.
void editingFinished()
Signal emitted when the user finishes editing the slider value.
fltp08 getValue() const
Returns the current slider value as a floating-point percent.
void edited(fltp08 percent)
Signal emitted when the slider value changes.
void setVertical(bool is_vertical)
Sets the slider orientation to vertical or horizontal.
void onEditedSlot()
Slot called when the slider value is edited by the user.
The primary namespace for the NDEVR SDK.
double fltp08
Defines an alias representing an 8 byte floating-point number.
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.
Definition Angle.h:408