Files
qt6-migration-pipeline/TetraIF/LogView/LogViewBooleanEdit.cpp
T
2026-07-14 12:07:36 +02:00

37 lines
719 B
C++

#include "LogViewBooleanEdit.hpp"
#include "LogViewField.hpp"
#include "LogViewTelegram.hpp"
namespace N_LogView
{
LogViewBooleanEdit::LogViewBooleanEdit(LogViewField* a_field, QWidget* a_parent, const bool a_readonly)
: QCheckBox (a_parent)
, LogViewWidget(a_field, this, a_parent, a_readonly)
{
const QString valueText = a_field->value(0);
setChecked(valueText.toInt() == 1);
setEnabled(!a_readonly);
}
bool LogViewBooleanEdit::saveContent(LogViewTelegram* a_telegram)
{
if (m_Valid)
{
if (a_telegram->isJsonTelegram())
a_telegram->setJsonValue(m_Field->jsonPath(), isChecked());
else
a_telegram->setUIntX(getSize(), isChecked());
return true;
}
return false;
}
}