-
Notifications
You must be signed in to change notification settings - Fork 0
/
previewwidget.h
47 lines (38 loc) · 1.04 KB
/
previewwidget.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
#ifndef PREVIEWWIDGET_H
#define PREVIEWWIDGET_H
#include <QOpenGLWidget>
#include <QPixmap>
class PreviewWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(QSize imageSize READ imageSize NOTIFY imageSizeChanged)
public:
explicit PreviewWidget(QWidget *owner = nullptr);
QSize imageSize();
QRect imageSelection();
QString imageFilename();
QString makeTempImage();
public slots:
void loadImage(QString file);
void offsetImage(QPoint topLeft);
signals:
void imageSizeChanged(QSize size);
void wheelHorizontal(int delta);
void wheelVertical(int delta);
protected:
void resizeEvent(QResizeEvent *event);
void paintEvent(QPaintEvent *event);
void mousePressEvent(QMouseEvent *ev);
void mouseReleaseEvent(QMouseEvent *ev);
void mouseMoveEvent(QMouseEvent *ev);
void wheelEvent(QWheelEvent *ev);
private:
void updateSelection();
QString imageFile;
QPixmap image;
QPoint imageOffset;
QRect selectionRect;
QSize glSize;
QPoint mp, mp0, mp1;
};
#endif // PREVIEWWIDGET_H