-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelectRect.h
50 lines (39 loc) · 1.1 KB
/
SelectRect.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
#ifndef SELECTRECT_H
#define SELECTRECT_H
#include <QRect>
#include <QPainter>
class SelectRect : public QRect
{
public:
enum Orientation{
None = -1,
LeftTop = 0,
Top = 1,
RightTop = 2,
Right,
RightBottom,
Bottom,
LeftBottom,
Left
};
SelectRect();
explicit SelectRect(const QRect &parentRect);
explicit operator QRect() const;
~SelectRect() = default;
void drawSelectBorder(QPainter &paint);
Orientation checkOrientation(const QPoint& point, QPoint &extraPoint = QPoint());
Qt::CursorShape cursorShape(const QPoint &point);
void moveRect(const QPoint& movePos);
void resizeRect(const QPoint &pSource, const QPoint& resizeVector);
QRect parentRect() const;
void setParentRect(const QRect &parentRect);
void setOrient(const Orientation &orient);
QRect absoluteRect();
private:
void growRect(const QPoint &pSource, const QPoint &resizeVector);
Orientation m_orient = None;
QRect m_parentRect;
int m_pointRadius = 4;
int m_lineWidth = 2;
};
#endif // SELECTRECT_H