This commit is contained in:
2026-02-14 14:31:11 +01:00
parent 0854a6ba7e
commit bf6d5c5182
10 changed files with 64 additions and 54 deletions
+1 -1
View File
@@ -3,8 +3,8 @@
#include "ui_button.hpp" #include "ui_button.hpp"
#include "ui_checkbox.hpp" #include "ui_checkbox.hpp"
#include "ui_combobox.hpp" #include "ui_combobox.hpp"
#include "ui_double_spinbox.hpp"
#include "ui_dial.hpp" #include "ui_dial.hpp"
#include "ui_double_spinbox.hpp"
#include "ui_hex_spinbox.hpp" #include "ui_hex_spinbox.hpp"
#include "ui_label.hpp" #include "ui_label.hpp"
#include "ui_led.hpp" #include "ui_led.hpp"
+2 -1
View File
@@ -4,7 +4,8 @@ UI_double_spinbox::UI_double_spinbox(QObject* parent) : UI_item(UI_DOUBLE_SPINBO
{ {
} }
UI_double_spinbox::UI_double_spinbox(double min, double max, double value, QObject* parent) : UI_item(UI_DOUBLE_SPINBOX_TYPE, parent) UI_double_spinbox::UI_double_spinbox(double min, double max, double value, QObject *parent)
: UI_item(UI_DOUBLE_SPINBOX_TYPE, parent)
{ {
m_min = min; m_min = min;
m_max = max; m_max = max;
+2 -1
View File
@@ -5,7 +5,8 @@
#define UI_DOUBLE_SPINBOX_TYPE std::string("ui_double_spinbox") #define UI_DOUBLE_SPINBOX_TYPE std::string("ui_double_spinbox")
class UI_double_spinbox : public UI_item { class UI_double_spinbox : public UI_item
{
Q_OBJECT Q_OBJECT
public: public:
explicit UI_double_spinbox(QObject *parent = nullptr); explicit UI_double_spinbox(QObject *parent = nullptr);
+4 -2
View File
@@ -1,9 +1,11 @@
#include "ui_hex_spinbox.hpp" #include "ui_hex_spinbox.hpp"
UI_hex_spinbox::UI_hex_spinbox(QObject* parent) : UI_item(UI_HEX_SPINBOX_TYPE, parent) { UI_hex_spinbox::UI_hex_spinbox(QObject *parent) : UI_item(UI_HEX_SPINBOX_TYPE, parent)
{
} }
UI_hex_spinbox::UI_hex_spinbox(double min, double max, double value, QObject* parent) : UI_item(UI_HEX_SPINBOX_TYPE, parent) UI_hex_spinbox::UI_hex_spinbox(double min, double max, double value, QObject *parent)
: UI_item(UI_HEX_SPINBOX_TYPE, parent)
{ {
m_min = min; m_min = min;
m_max = max; m_max = max;
+2 -1
View File
@@ -5,7 +5,8 @@
#define UI_HEX_SPINBOX_TYPE std::string("ui_hex_spinbox") #define UI_HEX_SPINBOX_TYPE std::string("ui_hex_spinbox")
class UI_hex_spinbox : public UI_item { class UI_hex_spinbox : public UI_item
{
Q_OBJECT Q_OBJECT
public: public:
explicit UI_hex_spinbox(QObject *parent = nullptr); explicit UI_hex_spinbox(QObject *parent = nullptr);
+2 -1
View File
@@ -5,7 +5,8 @@
#define UI_SPINBOX_TYPE std::string("ui_spinbox") #define UI_SPINBOX_TYPE std::string("ui_spinbox")
class UI_spinbox : public UI_item { class UI_spinbox : public UI_item
{
Q_OBJECT Q_OBJECT
public: public:
explicit UI_spinbox(QObject *parent = nullptr); explicit UI_spinbox(QObject *parent = nullptr);
+9 -6
View File
@@ -772,8 +772,9 @@ void Simulator_base::setup_spinbox(QWidget *item, size_t index)
if (spinbox == nullptr) if (spinbox == nullptr)
return; return;
connect(spinbox, &QSpinBox::valueChanged, this, connect(spinbox, &QSpinBox::valueChanged, this, [=, this](int value) {
[=, this](int value) { m_web_socket->send_event(Web_socket_wrapper::Event::value_changed, index, (double)value); }); m_web_socket->send_event(Web_socket_wrapper::Event::value_changed, index, (double)value);
});
} }
void Simulator_base::setup_double_spinbox(QWidget *item, size_t index) void Simulator_base::setup_double_spinbox(QWidget *item, size_t index)
@@ -782,8 +783,9 @@ void Simulator_base::setup_double_spinbox(QWidget *item, size_t index)
if (spinbox == nullptr) if (spinbox == nullptr)
return; return;
connect(spinbox, &QDoubleSpinBox::valueChanged, this, connect(spinbox, &QDoubleSpinBox::valueChanged, this, [=, this](double value) {
[=, this](double value) { m_web_socket->send_event(Web_socket_wrapper::Event::value_changed, index, value); }); m_web_socket->send_event(Web_socket_wrapper::Event::value_changed, index, value);
});
} }
void Simulator_base::setup_hex_spinbox(QWidget *item, size_t index) void Simulator_base::setup_hex_spinbox(QWidget *item, size_t index)
@@ -792,8 +794,9 @@ void Simulator_base::setup_hex_spinbox(QWidget *item, size_t index)
if (spinbox == nullptr) if (spinbox == nullptr)
return; return;
connect(spinbox, &HexSpinBox::valueChanged, this, connect(spinbox, &HexSpinBox::valueChanged, this, [=, this](int value) {
[=, this](int value) { m_web_socket->send_event(Web_socket_wrapper::Event::value_changed, index, (double)value); }); m_web_socket->send_event(Web_socket_wrapper::Event::value_changed, index, (double)value);
});
} }
void Simulator_base::setup_qwtplot(QWidget *item, size_t index) void Simulator_base::setup_qwtplot(QWidget *item, size_t index)
+1
View File
@@ -2,6 +2,7 @@
#include "UI.hpp" #include "UI.hpp"
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
#include "ui.hpp"
#include <QSerialPort> #include <QSerialPort>
#include <QTimer> #include <QTimer>