1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

LP-245 config: properly display hex in QLabel too

This commit is contained in:
Philippe Renon 2016-09-13 21:26:04 +02:00 committed by Philippe Renon
parent 7fd393bb79
commit bbd166045e

View File

@ -965,8 +965,17 @@ bool ConfigTaskWidget::setWidgetFromVariant(QWidget *widget, QVariant value, Wid
}
return ok;
} else if (QLabel * cb = qobject_cast<QLabel *>(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));
}