-
Notifications
You must be signed in to change notification settings - Fork 194
/
sliderWithTarget.h
47 lines (41 loc) · 1.18 KB
/
sliderWithTarget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
* SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef SLIDER_WITH_TARGET_H
#define SLIDER_WITH_TARGET_H
#include <QWidget>
#include <QSlider>
#include <QLabel>
#include <QTimer>
#include <QStyleOptionSlider>
#include <yarp/conf/compiler.h>
class SliderWithTarget : public QSlider
{
public:
bool enableViewLabel = true;
bool enableViewTargetBox = true;
bool enableViewTargetValue = false;
int number_of_decimals = 0;
bool disableClickOutOfHandle;
SliderWithTarget(QWidget * parent = 0);
~SliderWithTarget();
void updateSliderTarget(double val);
void resetTarget();
void setSliderStep(double val);
double getSliderStep();
void setValue(double val);
void setIsDouble(bool b);
bool getIsDouble();
protected:
bool isDouble;
QLabel* sliderCurrentLabel = nullptr;
QLabel* sliderTargetLabel = nullptr;
double target;
double width_at_target;
double sliderStep = 1;
void paintEvent(QPaintEvent *ev) override;
void mousePressEvent(QMouseEvent * event) override;
};
#endif // JOINTITEM_H