diff options
author | bd <bdunahu@operationnull.com> | 2025-04-21 15:56:38 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-21 15:56:38 -0400 |
commit | 40dfec9ae067d3f8e3868d259bfc4251aeca8724 (patch) | |
tree | 28316cbc00a8e89ead3225d80b9199381a996d86 /gui/digitlabel.cc | |
parent | 89763e6f696a96ad310f031c66960bcaaba3ffdb (diff) |
Add functionality to toggle button.
Diffstat (limited to 'gui/digitlabel.cc')
-rw-r--r-- | gui/digitlabel.cc | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/gui/digitlabel.cc b/gui/digitlabel.cc index ffecfff..8314943 100644 --- a/gui/digitlabel.cc +++ b/gui/digitlabel.cc @@ -16,11 +16,9 @@ // along with this program. If not, see <https://www.gnu.org/licenses/>. #include "digitlabel.h" +#include "gui.h" -DigitLabel::DigitLabel(QWidget *parent) : QLabel(parent) -{ - this->update_display(); -} +DigitLabel::DigitLabel(QWidget *parent) : QLabel(parent) { setText(QString()); } void DigitLabel::clear() { @@ -31,16 +29,14 @@ void DigitLabel::clear() void DigitLabel::set_value(int v) { this->is_cleared = false; - if (this->v != v) { - this->v = v; - update_display(); - } + this->v = v; + update_display(); } -void DigitLabel::toggle_mode() +void DigitLabel::on_hex_toggle(bool is_hex) { - this->is_hex = !this->is_hex; - this->update_display(); + this->is_hex = is_hex; + update_display(); } void DigitLabel::update_display() @@ -49,7 +45,7 @@ void DigitLabel::update_display() if (this->is_cleared) { setText(QString()); } else { - t = (this->is_hex) ? QString::number(this->v, 6).toUpper() + t = (this->is_hex) ? QString::number(this->v, 16).toUpper() : QString::number(this->v); setText(t); } |