diff options
author | bd <bdunahu@operationnull.com> | 2025-04-19 15:14:56 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-19 15:14:56 -0400 |
commit | 2b5ca09c90c5e091c094e9ed8f02079674b8aeda (patch) | |
tree | 227821d3d081d211e5e27c0eb7358061ed24a686 /gui/digitlabel.h | |
parent | c375eba808841797a7339afcfe9c4426da53de75 (diff) |
Add new widget to display number in base 10 and 16
Diffstat (limited to 'gui/digitlabel.h')
-rw-r--r-- | gui/digitlabel.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/gui/digitlabel.h b/gui/digitlabel.h new file mode 100644 index 0000000..9106cc9 --- /dev/null +++ b/gui/digitlabel.h @@ -0,0 +1,52 @@ +#ifndef DIGITLABEL_H +#define DIGITLABEL_H + +#include <QLabel> + +class DigitLabel : public QLabel +{ + Q_OBJECT + + public: + /** + * Constructor. + * @return a newly allocated DigitLabel. + */ + explicit DigitLabel(QWidget *parent = nullptr); + + /** + * Sets the empty flag. + */ + void clear(); + /** + * @param the value to set `this->v' with. + */ + void set_value(int v); + + public slots: + /** + * Toggles the base this label displays in, by setting `this->is_hex'. + */ + void toggle_mode(); + + private: + /** + * Refreshes the display of this label, taking base into consideration.. + */ + void update_display(); + + /** + * The decimal value associated with this label. + */ + int v = 0; + /** + * To display in hexidecimal or not. + */ + bool is_hex = true; + /** + * To display in hexidecimal or not. + */ + bool is_cleared = true; +}; + +#endif // DIGITLABEL_H |