-
Notifications
You must be signed in to change notification settings - Fork 1
/
imagelabel.h
101 lines (93 loc) · 3.49 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/***********************************************************************
* FILENAME : imagelabel.h
*
* LICENSE:
* qcvTouchUp provides an image processing toolset for editing
* photographs, purposed and packaged for use in a desktop application
* user environment. Copyright (C) 2018, Matthew R. Miller
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation (version 3 of the License) and the
* 3-clause BSD License as agreed upon through the use of the Qt toolkit
* and OpenCV libraries in qcvTouchUp development, respectively. Copies
* of the appropriate license files for qcvTouchup, and its source code,
* can be found in LICENSE.Qt.txt and LICENSE.CV.txt.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License and
* 3-clause BSD License along with this program. If not, please see
* <http://www.gnu.org/licenses/> and <https://opencv.org/license.html>.
*
* If you wish to contact the developer about this project, please do so
* through their account at <https://github.com/mattrussmill>
*
* DESCRIPTION :
* This class extends the QLabel class to display the crop region
* visualizations necessary to use the TransformMenu object effectively.
*
* NOTES :
*
*
* AUTHOR : Matthew R. Miller START DATE : March 03/04/2019
*
* CHANGES : N/A - N/A
*
* VERSION DATE WHO DETAIL
* 0.1 10/20/2019 Matthew R. Miller Initial Rev
*
************************************************************************/
#ifndef IMAGELABEL_H
#define IMAGELABEL_H
#include <QLabel>
class ImageLabel : public QLabel
{
Q_OBJECT
public:
ImageLabel(QWidget *parent = nullptr);
uint getRetrieveCoordinateMode();
enum CoordinateMode
{
NoClick = 0x0,
SingleClick = 0x1,
SingleUnclick = 0x2,
ClickUnclick = 0x4,
ClickDrag = 0x8,
RectROI = 0x10,
DragROI = 0x20,
BrushImage = 0x40
};
signals:
void imagePointSelected(QPoint selectedPoint);
void imageRectRegionSelected(QRect roi);
public slots:
void initializePaintMembers();
void setRetrieveCoordinateMode(uint mode);
void setRectRegionSelected(QRect roi);
protected:
virtual void mouseReleaseEvent(QMouseEvent *event) override;
virtual void mousePressEvent(QMouseEvent *event) override;
virtual void mouseMoveEvent(QMouseEvent *event) override;
virtual void paintEvent(QPaintEvent *event) override;
private:
QPoint getPointInImage(QMouseEvent *event);
QRect getAdjustedImageRegion();
QRect getAdjustedWidgetRegion();
void leftMousePressEvent(QMouseEvent *event);
void leftMouseMoveEvent(QMouseEvent *event);
void leftMouseReleaseEvent(QMouseEvent *event);
void setPointFromImage(); //getPointInImage from ImageWidget
QPoint imageDragStart_m;
QPoint widgetDragStart_m;
QRect imageRegion_m;
QRect widgetRegion_m;
uchar brushRadius_m;
float scaleWidth_m = 0;
float scaleHeight_m = 0;
uint retrieveCoordinateMode_m = NoClick;
};
#endif // IMAGELABEL_H