From 90030e2c659deb06fbeebc264dac379fb628dd61 Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Thu, 13 Feb 2025 19:25:26 +0100 Subject: [PATCH] b client simbase fix slider/thermo/dial issue with value labels --- client/simulator_base.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/client/simulator_base.cpp b/client/simulator_base.cpp index fd72cd8..1d8dc8c 100644 --- a/client/simulator_base.cpp +++ b/client/simulator_base.cpp @@ -179,12 +179,13 @@ void SimulatorBase::process_ui_slider(json &uiItem) bool visible = uiItem["visible"]; QString unit = QString::fromStdString(uiItem.at("unit")); + if (label != nullptr) + { + label->setText(QString("%0 %1").arg(value).arg(unit)); + } + if (slider->value() != value) { - if (label != nullptr) - { - label->setText(QString("%0 %1").arg(value).arg(unit)); - } slider->setValue(value); } @@ -222,12 +223,13 @@ void SimulatorBase::process_ui_dial(json &uiItem) bool visible = uiItem["visible"]; QString unit = QString::fromStdString(uiItem.at("unit")); + if (label != nullptr) + { + label->setText(QString("%0 %1").arg(value).arg(unit)); + } + if (dial->value() != value) { - if (label != nullptr) - { - label->setText(QString("%0 %1").arg(value).arg(unit)); - } dial->setValue(value); } @@ -259,12 +261,13 @@ void SimulatorBase::process_ui_thermo(json &uiItem) bool visible = uiItem["visible"]; QString unit = QString::fromStdString(uiItem.at("unit")); + if (label != nullptr) + { + label->setText(QString("%0 %1").arg(value).arg(unit)); + } + if (thermo->value() != value) { - if (label != nullptr) - { - label->setText(QString("%0 %1").arg(value).arg(unit)); - } thermo->setValue(value); }