diff --git a/src/FactSystem/FactGroup.cc b/src/FactSystem/FactGroup.cc index c67c02d8f55a2a2ec118db30cf9dd7b46747aa6d..55aedaf9869c6f4bc047fc5954ef7414c5918139 100644 --- a/src/FactSystem/FactGroup.cc +++ b/src/FactSystem/FactGroup.cc @@ -46,7 +46,8 @@ void FactGroup::_setupTimer() if (_updateRateMSecs > 0) { connect(&_updateTimer, &QTimer::timeout, this, &FactGroup::_updateAllValues); _updateTimer.setSingleShot(false); - _updateTimer.start(_updateRateMSecs); + _updateTimer.setInterval(_updateRateMSecs); + _updateTimer.start(); } } @@ -125,3 +126,19 @@ void FactGroup::_updateAllValues(void) fact->sendDeferredValueChangedSignal(); } } + +void FactGroup::setLiveUpdates(bool liveUpdates) +{ + if (_updateTimer.interval() == 0) { + return; + } + + if (liveUpdates) { + _updateTimer.stop(); + } else { + _updateTimer.start(); + } + for(Fact* fact: _nameToFactMap) { + fact->setSendValueChangedSignals(liveUpdates); + } +} diff --git a/src/FactSystem/FactGroup.h b/src/FactSystem/FactGroup.h index 78a97fcb60c79ddc140b68a7476d50ae2e8930f2..9e8320fca0cfcc977f8f70f23e23aac04a58ba6b 100644 --- a/src/FactSystem/FactGroup.h +++ b/src/FactSystem/FactGroup.h @@ -38,6 +38,9 @@ public: /// @return FactGroup for specified name, NULL if not found Q_INVOKABLE FactGroup* getFactGroup(const QString& name); + /// Turning on live updates will allow value changes to flow through as they are received. + Q_INVOKABLE void setLiveUpdates(bool liveUpdates); + QStringList factNames(void) const { return _factNames; } QStringList factGroupNames(void) const { return _nameToFactGroupMap.keys(); }