Commit cf2bd6a3 authored by Michael Carpenter's avatar Michael Carpenter

Handling of QVariant::Char display type in QGCParamWidget::addParameter

parent 8a885d53
......@@ -400,6 +400,7 @@ void QGCParamWidget::addParameter(int uas, int component, int paramCount, int pa
if (map && map->contains(parameterName))
{
justWritten = true;
QVariant newval = map->value(parameterName);
if (map->value(parameterName) != value)
{
writeMismatch = true;
......@@ -551,7 +552,14 @@ void QGCParamWidget::addParameter(int uas, int component, QString parameterName,
{
//qDebug() << "UPDATED CHILD";
parameterItem = child;
parameterItem->setData(1, Qt::DisplayRole, value);
if (value.type() == QVariant::Char)
{
parameterItem->setData(1, Qt::DisplayRole, value.toUInt());
}
else
{
parameterItem->setData(1, Qt::DisplayRole, value);
}
found = true;
}
}
......@@ -564,7 +572,14 @@ void QGCParamWidget::addParameter(int uas, int component, QString parameterName,
// CREATE PARAMETER ITEM
parameterItem = new QTreeWidgetItem(plist);
// CONFIGURE PARAMETER ITEM
parameterItem->setData(1, Qt::DisplayRole, value);
if (value.type() == QVariant::Char)
{
parameterItem->setData(1, Qt::DisplayRole, value.toUInt());
}
else
{
parameterItem->setData(1, Qt::DisplayRole, value);
}
compParamGroups->value(parent)->addChild(parameterItem);
parameterItem->setFlags(parameterItem->flags() | Qt::ItemIsEditable);
......@@ -708,6 +723,12 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column)
parameters.value(key)->insert(str, fixedValue);
}
break;
case QMetaType::QChar:
{
QVariant fixedValue(QChar((unsigned char)value.toUInt()));
parameters.value(key)->insert(str, fixedValue);
}
break;
default:
qCritical() << "ABORTED PARAM UPDATE, NO VALID QVARIANT TYPE";
return;
......@@ -999,6 +1020,13 @@ void QGCParamWidget::setParameter(int component, QString parameterName, QVariant
switch (parameters.value(component)->value(parameterName).type())
{
case QVariant::Char:
{
QVariant fixedValue(QChar((unsigned char)value.toInt()));
emit parameterChanged(component, parameterName, fixedValue);
//qDebug() << "PARAM WIDGET SENT:" << fixedValue;
}
break;
case QVariant::Int:
{
QVariant fixedValue(value.toInt());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment