diff options
author | bd <bdunahu@operationnull.com> | 2025-04-26 14:29:48 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-26 14:29:48 -0400 |
commit | 1c174cc103cb1b00befed6e52b40bb3e76cc7797 (patch) | |
tree | e330ba0b693b6aad6d361883b6e35986ee48971d /gui | |
parent | 94c0d7b5045244f20dfa13f7d31e0e06901908c2 (diff) |
Use two's complement in number display
Diffstat (limited to 'gui')
-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); } }; |