00001 #ifndef UTILS_H 00002 #define UTILS_H 00003 00004 #include <QObject> 00005 00006 class MonitoredValue: public QObject{ 00007 Q_OBJECT 00008 public: 00009 MonitoredValue(QObject* parent = nullptr): QObject(parent), _value(0) {} 00010 00011 void set(double newValue){ 00012 _value = newValue; 00013 emit valueChanged(_value); 00014 } 00015 00016 double get() const { return _value; } 00017 signals: 00018 void valueChanged(double); 00019 private: 00020 double _value; 00021 }; 00022 00023 #endif // UTILS_H