-
Notifications
You must be signed in to change notification settings - Fork 0
/
area_progress_bar.h
56 lines (42 loc) · 1.04 KB
/
area_progress_bar.h
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
53
54
55
56
#ifndef AREA_PROGRESS_BAR_H
#define AREA_PROGRESS_BAR_H
#include <vector>
#include <QWidget>
struct Pixel {
int x;
int y;
};
struct PixelHasher {
std::size_t operator()(const Pixel & pixel) const;
};
class AreaProgressBar : public QWidget
{
Q_OBJECT
public:
AreaProgressBar(QWidget *parent = 0);
~AreaProgressBar();
int maximum() const;
int minimum() const;
int value() const;
virtual QString text() const;
public slots:
void reset();
void setMaximum(int maximum);
void setMinimum(int minimum);
void setRange(int minimum, int maximum);
void setValue(int value);
signals:
void valueChanged(int value);
protected:
void paintEvent(QPaintEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
float minMaxScale(float x, float xMin, float xMax, float yMin, float yMax);
private:
int _value;
int _minimum;
int _maximum;
uint _seed;
std::vector<Pixel> * _usedPixels;
std::vector<Pixel> * _unusedPixels;
};
#endif // AREA_PROGRESS_BAR_H