-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImageWidget.h
99 lines (73 loc) · 2.25 KB
/
ImageWidget.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
/*
* ImageWidget.h
*
* Created on: Mar 29, 2014
* Author: Tim
*/
#ifndef IMAGEWIDGET_H_
#define IMAGEWIDGET_H_
/*****************************************************************************
****************************** I N C L U D E *******************************
*****************************************************************************/
#include <QWidget>
#include "DQRubberBand.h"
#include "DQImage.h"
/*****************************************************************************
*
*** class DImageWidget
*
* Class to provide a dedicated way to display and interact with a DQImage
* (enhanced QImage).
*
*****************************************************************************/
class DImageWidget : public QWidget
{
Q_OBJECT
public:
enum ETipType { eTipRGB, eTipIndex };
DImageWidget(QWidget* pParent = nullptr);
DImageWidget(const DImageWidget& src) = delete;
~DImageWidget() = default;
DImageWidget& operator=(const DImageWidget& rhs) = delete;
bool SetImage(const QImage& Image);
bool SetImage(const DQImage& Image);
bool IsRubberBand() const
{
return (m_pRubberBand->IsEnabled());
}
const DQImage& GetImage() const
{
return (m_Image);
}
DQImage& GetImage()
{
return (m_Image);
}
void SetTipType(ETipType eTipType)
{
m_eTipType = eTipType;
return;
}
ETipType GetTipType() const
{
return (m_eTipType);
}
signals:
void ROIChanged(const QRect& ROI);
public slots:
void SetROI(const QRect& ROI);
void ClearROI();
void EnableRubberBand();
void DisableRubberBand();
protected:
DQImage m_Image;
DQRubberBand* m_pRubberBand;
ETipType m_eTipType;
void paintEvent(QPaintEvent* pEvent);
// Overridden for rubber banding and value display
void mousePressEvent(QMouseEvent* pEvent);
void mouseMoveEvent(QMouseEvent* pEvent);
void mouseReleaseEvent(QMouseEvent *pEvent);
private:
}; // end of class DImageWidget
#endif /* IMAGEWIDGET_H_ */