b client simbase

fix slider/thermo/dial issue with value labels
This commit is contained in:
2026-02-14 14:30:47 +01:00
parent 2e5ba3caae
commit 90030e2c65
+15 -12
View File
@@ -179,12 +179,13 @@ void SimulatorBase::process_ui_slider(json &uiItem)
bool visible = uiItem["visible"]; bool visible = uiItem["visible"];
QString unit = QString::fromStdString(uiItem.at("unit")); QString unit = QString::fromStdString(uiItem.at("unit"));
if (label != nullptr)
{
label->setText(QString("%0 %1").arg(value).arg(unit));
}
if (slider->value() != value) if (slider->value() != value)
{ {
if (label != nullptr)
{
label->setText(QString("%0 %1").arg(value).arg(unit));
}
slider->setValue(value); slider->setValue(value);
} }
@@ -222,12 +223,13 @@ void SimulatorBase::process_ui_dial(json &uiItem)
bool visible = uiItem["visible"]; bool visible = uiItem["visible"];
QString unit = QString::fromStdString(uiItem.at("unit")); QString unit = QString::fromStdString(uiItem.at("unit"));
if (label != nullptr)
{
label->setText(QString("%0 %1").arg(value).arg(unit));
}
if (dial->value() != value) if (dial->value() != value)
{ {
if (label != nullptr)
{
label->setText(QString("%0 %1").arg(value).arg(unit));
}
dial->setValue(value); dial->setValue(value);
} }
@@ -259,12 +261,13 @@ void SimulatorBase::process_ui_thermo(json &uiItem)
bool visible = uiItem["visible"]; bool visible = uiItem["visible"];
QString unit = QString::fromStdString(uiItem.at("unit")); QString unit = QString::fromStdString(uiItem.at("unit"));
if (label != nullptr)
{
label->setText(QString("%0 %1").arg(value).arg(unit));
}
if (thermo->value() != value) if (thermo->value() != value)
{ {
if (label != nullptr)
{
label->setText(QString("%0 %1").arg(value).arg(unit));
}
thermo->setValue(value); thermo->setValue(value);
} }