API Documentation
Loading...
Searching...
No Matches
QCustomSlider.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/BaseValues.h>
4#include <QSlider>
5namespace NDEVR
6{
7 /**--------------------------------------------------------------------------------------------------
8 \brief The slider is the classic widget for controlling a bounded value. It lets the user move a
9 slider handle along a horizontal or vertical groove and translates the handle's position
10 into a percent value 0.0 to 1.0.
11 *-----------------------------------------------------------------------------------------------**/
12 class NDEVR_WIDGETS_API QCustomSlider : public QSlider
13 {
14 Q_OBJECT
15 public:
16 QCustomSlider(Qt::Orientation orientation, QWidget* parent = nullptr)
17 : QSlider(orientation, parent)
18 {
19 init();
20 }
21 QCustomSlider(QWidget* parent = nullptr)
22 : QSlider(parent)
23 {
24 init();
25 }
27 {
28 return cast<fltp08>(value()) / sliderScale();
29 }
30 void setValue(fltp08 value)
31 {
32 QSlider::setValue(cast<int>(value * sliderScale()));
33 }
34 void setMaximum(fltp08 value)
35 {
36 QSlider::setMaximum(cast<int>(value * sliderScale()));
37 }
38 void setMinimum(fltp08 value)
39 {
40 QSlider::setMinimum(cast<int>(value * sliderScale()));
41 }
42 void setRange(fltp08 min, fltp08 max);
43 protected:
45 {
46 fltp08 value = 100.0;
47 return value;
48 }
49 void init();
50 protected slots:
52 signals:
53 void edited(fltp08 percent);
55 };
56}
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:81
The slider is the classic widget for controlling a bounded value. It lets the user move a slider hand...
Definition QCustomSlider.h:13
void edited(fltp08 percent)
QCustomSlider(QWidget *parent=nullptr)
Definition QCustomSlider.h:21
fltp08 getValue() const
Definition QCustomSlider.h:26
void setValue(fltp08 value)
Definition QCustomSlider.h:30
void setMaximum(fltp08 value)
Definition QCustomSlider.h:34
fltp08 sliderScale() const
Definition QCustomSlider.h:44
void setRange(fltp08 min, fltp08 max)
void setMinimum(fltp08 value)
Definition QCustomSlider.h:38
QCustomSlider(Qt::Orientation orientation, QWidget *parent=nullptr)
Definition QCustomSlider.h:16
Definition ACIColor.h:37
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:146