Files
remote-ui/UI/ui_hex_spinbox.cpp
T
sani7 efcb183682 ui_items
Remove Text_size
Add setup_item to configure if an item uses text, fg color and bg color.
2026-02-14 14:32:08 +01:00

59 lines
1.1 KiB
C++

#include "ui_hex_spinbox.hpp"
UI_hex_spinbox::UI_hex_spinbox(QObject *parent) : UI_item(UI_HEX_SPINBOX_TYPE, parent)
{
setup_item(false, false, false);
}
UI_hex_spinbox::UI_hex_spinbox(double min, double max, double value, QObject *parent)
: UI_item(UI_HEX_SPINBOX_TYPE, parent)
{
setup_item(false, false, false);
m_min = min;
m_max = max;
m_value = value;
}
void UI_hex_spinbox::set_value(double value)
{
if (value < m_min || value > m_max)
return;
if (value == m_value)
return;
this->m_value = value;
emit ui_changed();
emit changed(m_value);
}
double UI_hex_spinbox::value() const
{
return m_value;
}
double UI_hex_spinbox::min() const
{
return m_min;
}
double UI_hex_spinbox::max() const
{
return m_max;
}
void UI_hex_spinbox::from_json(const json &j)
{
UI_item::from_json(j);
this->m_min = j.at("min");
this->m_max = j.at("max");
this->m_value = j.at("value");
}
json UI_hex_spinbox::to_json(size_t id) const
{
json j = UI_item::to_json(id);
j["min"] = this->m_min;
j["max"] = this->m_max;
j["value"] = this->m_value;
return j;
}