-
Notifications
You must be signed in to change notification settings - Fork 0
/
blockarea.h
60 lines (47 loc) · 1.31 KB
/
blockarea.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
57
58
59
60
#ifndef BLOCKAREA_H
#define BLOCKAREA_H
#include "extentinfo.h"
#include <QAbstractScrollArea>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QResizeEvent>
#include <QWheelEvent>
#include <vector>
class BlockArea : public QAbstractScrollArea, public ExtentInfo {
Q_OBJECT
public:
explicit BlockArea(QWidget *parent);
void setPhysicalBlockCount(int count);
void setScale(int scale);
int getScale() { return scale; }
void scan(QString path);
void setSelectedFile(QString path);
void unsetSelectedFile();
signals:
void mouseClicked(int index);
void zoomed(int x, int y);
protected:
void paintEvent(QPaintEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
void wheelEvent(QWheelEvent *event) override;
private:
void onStatusBarChanged(int value);
void updateParams(QSize size);
private:
int xNum;
int yNum;
int yMax;
int yOffset;
int blockCount;
int scale;
int physicalBlockCount;
FileNode *selectedFile;
bool zoomEnabled;
static constexpr int blockSize = 8;
static constexpr int blockSpace = 0;
};
#endif // BLOCKAREA_H