mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Update UI
This commit is contained in:
+14
-32
@@ -1,57 +1,39 @@
|
||||
#include "ui_spinbox.hpp"
|
||||
|
||||
UI_spinbox::UI_spinbox(QObject *parent) : UI_item(UI_enum::ui_spinbox, parent)
|
||||
UI_spinbox::UI_spinbox(QObject *parent) : UI_item(UI_typeGadget::UI_type::ui_spinbox, parent)
|
||||
{
|
||||
setup_item(false, false, false);
|
||||
m_ui_item.setSpinbox(UI_spinbox_m());
|
||||
}
|
||||
|
||||
UI_spinbox::UI_spinbox(double min, double max, double value, QObject *parent) : UI_item(UI_enum::ui_spinbox, parent)
|
||||
UI_spinbox::UI_spinbox(double min, double max, double value, QObject *parent) : UI_item(UI_typeGadget::UI_type::ui_spinbox, parent)
|
||||
{
|
||||
setup_item(false, false, false);
|
||||
m_min = min;
|
||||
m_max = max;
|
||||
m_value = value;
|
||||
m_ui_item.setSpinbox(UI_spinbox_m());
|
||||
m_ui_item.spinbox().setMin(min);
|
||||
m_ui_item.spinbox().setMax(max);
|
||||
m_ui_item.spinbox().setValue(value);
|
||||
}
|
||||
|
||||
void UI_spinbox::set_value(double value)
|
||||
{
|
||||
if (value < m_min || value > m_max)
|
||||
if (value < m_ui_item.spinbox().min() || value > m_ui_item.spinbox().max())
|
||||
return;
|
||||
if (value == m_value)
|
||||
if (value == m_ui_item.spinbox().value())
|
||||
return;
|
||||
|
||||
this->m_value = value;
|
||||
m_ui_item.spinbox().setValue(value);
|
||||
emit ui_changed();
|
||||
emit changed(m_value);
|
||||
emit changed(m_ui_item.spinbox().value());
|
||||
}
|
||||
double UI_spinbox::value() const
|
||||
{
|
||||
return m_value;
|
||||
return m_ui_item.spinbox().value();
|
||||
}
|
||||
|
||||
double UI_spinbox::min() const
|
||||
{
|
||||
return m_min;
|
||||
return m_ui_item.spinbox().min();
|
||||
}
|
||||
double UI_spinbox::max() const
|
||||
{
|
||||
return m_max;
|
||||
}
|
||||
|
||||
void UI_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_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;
|
||||
return m_ui_item.spinbox().max();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user