-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathImageLabel.h
53 lines (40 loc) · 1.03 KB
/
ImageLabel.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
#ifndef IMAGELABEL_H
#define IMAGELABEL_H
#include <QLabel>
#include <QRubberBand>
#include <QMouseEvent>
#include <QImage>
class ImageLabel : public QLabel
{
Q_OBJECT
protected:
QRubberBand *_rubberBand;
QPoint _click_pos;
QPoint _previous_mouse_pos;
QPoint _origin;
QPoint _end;
QRect _selection;
float _current_scale;
bool _selection_active;
bool _move_selection;
bool _draw_selection;
QSize _input_size;
public:
explicit ImageLabel(QWidget *parent = 0);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void paintEvent(QPaintEvent *e);
void setScale( float scale );
void setDrawSelection(bool draw_selection);
QImage crop();
QRect getSelection();
QPoint getClickedPixel();
void setImage( const QImage &image);
void updateImage( const QImage &image);
signals:
void selectionChanged();
void pointClicked();
public slots:
};
#endif // IMAGELABEL_H