mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Move to Qt
Everything seems to be working Only timer is not moved over
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
#include "UI_checkbox.hpp"
|
||||
|
||||
UI_checkbox::UI_checkbox() : UI_x_boxes(UI_CHECKBOX_TYPE), m_selected(), m_on_change(nullptr)
|
||||
UI_checkbox::UI_checkbox(QObject* parrent) : UI_x_boxes(UI_CHECKBOX_TYPE, parrent), m_selected()
|
||||
{
|
||||
}
|
||||
|
||||
UI_checkbox::UI_checkbox(std::string id, std::string text, Color fg_color, Color bg_color,
|
||||
std::vector<std::string> options,
|
||||
std::function<void(std::string, std::vector<std::string>)> on_change)
|
||||
: UI_x_boxes(id, UI_CHECKBOX_TYPE, text, fg_color, bg_color, options), m_selected(), m_on_change(on_change)
|
||||
std::vector<std::string> options, QObject* parrent)
|
||||
: UI_x_boxes(id, UI_CHECKBOX_TYPE, text, fg_color, bg_color, options, parrent), m_selected()
|
||||
{
|
||||
for (size_t i = 0; i < m_options.size(); i++)
|
||||
{
|
||||
@@ -15,7 +14,7 @@ UI_checkbox::UI_checkbox(std::string id, std::string text, Color fg_color, Color
|
||||
}
|
||||
}
|
||||
|
||||
UI_checkbox::UI_checkbox(const json &j) : UI_x_boxes(UI_CHECKBOX_TYPE), m_selected(), m_on_change(nullptr)
|
||||
UI_checkbox::UI_checkbox(const json &j, QObject* parrent) : UI_x_boxes(UI_CHECKBOX_TYPE, parrent), m_selected()
|
||||
{
|
||||
from_json(j);
|
||||
}
|
||||
@@ -25,10 +24,8 @@ void UI_checkbox::toggle_selected(size_t selected)
|
||||
if (selected >= m_options.size())
|
||||
return;
|
||||
m_selected[selected] = !m_selected[selected];
|
||||
if (m_on_change != nullptr)
|
||||
{
|
||||
std::thread([this] { m_on_change(m_id, selected_text()); }).detach();
|
||||
}
|
||||
emit value_changed();
|
||||
emit on_change(m_id, selected_text()[selected]);
|
||||
}
|
||||
|
||||
void UI_checkbox::toggle_selected(std::string selected)
|
||||
|
||||
Reference in New Issue
Block a user