summaryrefslogtreecommitdiff
path: root/gui/digitlabel.h
blob: 9106cc916f5c189b78af0b6a39b376441b539c9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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