summaryrefslogtreecommitdiff
path: root/gui/digitlabel.h
diff options
context:
space:
mode:
Diffstat (limited to 'gui/digitlabel.h')
-rw-r--r--gui/digitlabel.h52
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