From bbd166045e9952563818f6ad9599b54296db61f5 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Tue, 13 Sep 2016 21:26:04 +0200 Subject: [PATCH] LP-245 config: properly display hex in QLabel too --- .../uavobjectwidgetutils/configtaskwidget.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ground/gcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp b/ground/gcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp index 5de7e79d9..98dcaf93a 100644 --- a/ground/gcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp +++ b/ground/gcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp @@ -965,8 +965,17 @@ bool ConfigTaskWidget::setWidgetFromVariant(QWidget *widget, QVariant value, Wid } return ok; } else if (QLabel * cb = qobject_cast(widget)) { - if (scale == 0) { - cb->setText(value.toString()); + if ((scale == 0) || (scale == 1)) { + if (binding->units() == "hex") { + if (value.toUInt()) { + cb->setText(QString::number(value.toUInt(), 16).toUpper()); + } else { + // display 0 as an empty string + cb->setText(""); + } + } else { + cb->setText(value.toString()); + } } else { cb->setText(QString::number(value.toDouble() / scale)); }