From b1a2ee3fb304c3ba57ca2640307af8406d9010ff Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Mon, 21 Oct 2024 15:10:49 +0200 Subject: [PATCH] Sim test ID to label --- Qt/simulators/sim-test.cpp | 13 ++++++ Qt/simulators/sim-test.h | 2 + Qt/simulators/sim-test.ui | 90 ++++++++++++++++++++++++++------------ 3 files changed, 76 insertions(+), 29 deletions(-) diff --git a/Qt/simulators/sim-test.cpp b/Qt/simulators/sim-test.cpp index aa0382a..867ccf8 100644 --- a/Qt/simulators/sim-test.cpp +++ b/Qt/simulators/sim-test.cpp @@ -80,3 +80,16 @@ void Test_Sim::setup_dials(void) create_dial_needle(dial); } } + +QLabel* Test_Sim::id_to_label(size_t id) +{ + QWidget* widget = ui_lookup.at(id); + if (widget == ui->slider) + return ui->slider_label; + if (widget == ui->thermo) + return ui->thermo_label; + if (widget == ui->dial) + return ui->dial_label; + + return nullptr; +} diff --git a/Qt/simulators/sim-test.h b/Qt/simulators/sim-test.h index fd4ff5a..1fc0dd2 100644 --- a/Qt/simulators/sim-test.h +++ b/Qt/simulators/sim-test.h @@ -31,6 +31,8 @@ class Test_Sim : public SimulatorBase { void setup_comboboxes(void); void setup_dials(void); + QLabel* id_to_label(size_t name) override; + private: Ui::Test_Sim* ui; }; diff --git a/Qt/simulators/sim-test.ui b/Qt/simulators/sim-test.ui index ae89065..f9afe0e 100644 --- a/Qt/simulators/sim-test.ui +++ b/Qt/simulators/sim-test.ui @@ -15,53 +15,85 @@ - - - - PushButton - - - - + PushButton - - - - - - - 4 - - - 20.000000000000000 - - - 340.000000000000000 - - - - - + + - TextLabel + PushButton - - + + + + + + 0 + + + + + + + + + + + 0 + + + Qt::AlignmentFlag::AlignCenter + + + + + + + 4 + + + 20.000000000000000 + + + 340.000000000000000 + + + + + + + + + + + 0 + + + + + + + + + + TextLabel + + +