-
Notifications
You must be signed in to change notification settings - Fork 0
/
datavis.h
66 lines (57 loc) · 1.52 KB
/
datavis.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
61
62
63
64
65
66
#ifndef DATAVIS_H
#define DATAVIS_H
#include <QWidget>
#include <QScrollArea>
#include <QScrollBar>
#include <QLabel>
#include <QVBoxLayout>
#include <QImage>
#include <QBitmap>
#include <QMouseEvent>
class DataVis : public QWidget
{
Q_OBJECT
public:
explicit DataVis(QWidget *parent = 0,
char *buf = NULL,
long size = 0,
QImage::Format img_format = QImage::Format_RGB32);
void loadData(char*, long, QImage::Format img_format = QImage::Format_RGB32);
void clearData();
void refresh();
int calcPadding(long);
QPoint getPoint(QMouseEvent* me) { return label->mapFromParent(me->pos()); }
int getNBytes() { return n_bytes; }
int getPixelDepth() { return depth; }
int getWidth() { return w; }
void setWidth(int new_w) { w = new_w; }
int getHeight() { return h; }
int getMaxWidth() { return max_w; }
long getOffset() { return offset; }
float getScaling() { return cur_scaling; }
QScrollBar* getScrollbar() { return scrollbar; }
private:
virtual void mousePressEvent(QMouseEvent*);
void padData();
void maskPadding();
void scaleImage(float);
void loadNext(int, int);
char *data;
long n_bytes;
int padding;
int depth;
QImage::Format format;
QScrollArea *scrollarea;
QScrollBar *scrollbar;
QLabel *label;
QPixmap *pix;
int w, h;
int max_w;
long offset;
float cur_scaling;
private slots:
void onScroll(int);
signals:
public slots:
};
#endif // DATAVIS_H