diff options
-rw-r--r-- | gui/digitlabel.h | 2 | ||||
-rw-r--r-- | gui/digitlabelhelper.h | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/gui/digitlabel.h b/gui/digitlabel.h index 68b01cb..bffdd0a 100644 --- a/gui/digitlabel.h +++ b/gui/digitlabel.h @@ -59,7 +59,7 @@ class DigitLabel : public QLabel /** * If this digit should display in hexidecinmal. */ - int is_hex; + int is_hex = true; /** * If this digit should not display. */ diff --git a/gui/digitlabelhelper.h b/gui/digitlabelhelper.h index a0f845f..715089a 100644 --- a/gui/digitlabelhelper.h +++ b/gui/digitlabelhelper.h @@ -24,7 +24,8 @@ class DigitLabelHelper { public: /** - * Contains the main formatting logic used to format integers. + * Contains the main formatting logic used to format integers. Uses 2's + * complement for hexadecimal numbers. * @param the value to be formated * @param if the value should be displayed in hex. If false, displays in * decimal. @@ -35,7 +36,7 @@ class DigitLabelHelper { if (is_cleared) return QString(); - return is_hex ? QString::number(value, 16).toUpper() + return is_hex ? QString::asprintf("%04X", value) : QString::number(value); } }; |