SEPIA
Software documentation for the APEX SEPIA receivers
propertycontrol.h
1 /* Copyright 2017 Michael Olberg <michael.olberg@chalmers.se> */
2 #ifndef PROPERTYCONTROL_H
3 #define PROPERTYCONTROL_H
4 
5 #include <QDoubleSpinBox>
6 #include <QLabel>
7 
8 #include "../property.h"
9 
10 class PropertyControl : public QWidget
11 {
12  Q_OBJECT
13  Q_PROPERTY(double value READ actualValue WRITE setCommanded)
14 
15  public:
16  explicit PropertyControl(QWidget *parent = 0);
17  ~PropertyControl();
18 
19  double actualValue() const { return m_val.actual(); }
20  double commandedValue() const { return m_val.commanded(); }
21  QLabel *cmdValue;
22  QLabel *actValue;
23 
24  public slots:
25  void update(double val);
26  void setCommanded(double val);
27  void setDecimals(int dec) { m_decimals = dec; }
28 
29  private:
30  Property<double> m_val;
31  int m_decimals;
32  const double m_step;
33  const double m_min;
34  const double m_max;
35 };
36 
37 #endif // PROPERTYCONTROL_H