CalcMySky  v0.3.1
Manipulator.hpp
1 #ifndef INCLUDE_ONCE_66A25B12_D91A_4496_B4D2_0B1BA1B7A168
2 #define INCLUDE_ONCE_66A25B12_D91A_4496_B4D2_0B1BA1B7A168
3 
4 #include <QLabel>
5 #include <QWidget>
6 #include <QSlider>
7 #include <QDoubleSpinBox>
8 #include <QHBoxLayout>
9 
10 class Manipulator: public QWidget
11 {
12  Q_OBJECT
13 
14  QSlider*const slider;
15  QDoubleSpinBox*const spinbox;
16  QLabel*const label;
17  bool nonlinearSlider;
18 
19 public:
20  Manipulator(QString const& label, double min, double max, double defaultValue, int decimalPlaces=0, bool quasiExponentialSlider=false);
21 
22  void setValue(double val);
23  void setRange(double min, double max);
24  void setMax(double max);
25  void setLabel(QString const& text);
26  void setUnit(QString const& suffix);
27  double value() const;
28  double minimum() const;
29  double maximum() const;
30 
31  void onSpinboxValueChanged(double value);
32  void onSliderValueChanged(int value);
33 signals:
34  void valueChanged(double);
35 
36 private:
37  double linearToSlider(double linear) const;
38  double sliderToLinear(int slider) const;
39 };
40 
41 #endif
Definition: Manipulator.hpp:10