This repository has been archived on 2020-03-08. You can view files and clone it, but cannot push or open issues or pull requests.
pg-tp3/propslider.h

43 lines
754 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef PROPSLIDER_H
#define PROPSLIDER_H
#include <QSlider>
/*
Widget qui traduit les valeurs entières renvoyées par un QSlider en
double pour contrôler une propriété en fonction dun minimum, dun
maximum et dun pas.
*/
class PropSlider : public QSlider {
Q_OBJECT
double min = 0;
double max = 1;
double step = .1;
double value = .5;
int mapped_value;
int mapValue() const;
double unmapValue() const;
public:
PropSlider(QWidget *parent=nullptr);
void setMinimum(double min);
void setMaximum(double max);
void setStep(double step);
signals:
void valueChanged(double value);
public slots:
void setValue(double value);
private slots:
// Connecté au QSlider
void setValue(int mapped_value);
};
#endif