Adds q2 repos to migrate
This commit is contained in:
1 parent
ad1f62c4ee
commit
17f1c61c9e
991 files changed
+178451
No files matched your search
@@ -0,0 +1,96 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "LogViewTextEdit.hpp"
|
||||
#include "LogViewField.hpp"
|
||||
#include "LogViewTelegram.hpp"
|
||||
|
||||
namespace N_LogView
|
||||
{
|
||||
|
||||
|
||||
LogViewTextEdit::LogViewTextEdit(LogViewField* a_field, QWidget* a_parent, const bool a_readonly)
|
||||
: QLineEdit(a_parent)
|
||||
, LogViewWidget(a_field, this, a_parent, a_readonly)
|
||||
{
|
||||
const QString value = a_field->value(0);
|
||||
setText(value);
|
||||
|
||||
if (a_readonly)
|
||||
{
|
||||
setReadOnly(true);
|
||||
setAlignment(a_field->isRightAligned() ? Qt::AlignRight : Qt::AlignLeft);
|
||||
}
|
||||
|
||||
|
||||
uint16_t maxArraySize = a_field->maxArraySize();
|
||||
setMaxLength(maxArraySize);
|
||||
updateToolTip(value);
|
||||
|
||||
|
||||
QFontMetrics fm(font());
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||
setMinimumWidth(fm.width(QLatin1Char(' ') + value + QLatin1Char(' ')));
|
||||
#else
|
||||
setMinimumWidth(fm.horizontalAdvance(QLatin1Char(' ') + value + QLatin1Char(' ')));
|
||||
#endif
|
||||
|
||||
|
||||
connect(this, &LogViewTextEdit::editingFinished,
|
||||
this, &LogViewTextEdit::checkAndOvertakeContent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LogViewTextEdit::checkAndOvertakeContent()
|
||||
{
|
||||
updateToolTip(text());
|
||||
m_Valid = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool LogViewTextEdit::saveContent(LogViewTelegram* a_telegram)
|
||||
{
|
||||
if (!isValid())
|
||||
return false;
|
||||
if (a_telegram->isJsonTelegram())
|
||||
{
|
||||
a_telegram->setJsonValue(m_Field->jsonPath(), text());
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t size = getSize();
|
||||
QString content = text();
|
||||
uint16_t arraySize;
|
||||
if (m_Field->isDynamicArray())
|
||||
{
|
||||
arraySize = content.length();
|
||||
a_telegram->setUIntX(LogViewTelegram::SIZE_CENTRAL_DYN_ARRAY_SIZE, arraySize);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
arraySize = m_Field->maxArraySize();
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < arraySize; i++)
|
||||
a_telegram->setUIntX(size, i < content.length() ? content[i].toLatin1() : 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user