forked from ZhujinLi/SomeRuler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqkruler.h
55 lines (45 loc) · 1.22 KB
/
qkruler.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
#ifndef QKRULER_H
#define QKRULER_H
#include "geometrycalculator.h"
#include <QSystemTrayIcon>
#include <QWidget>
class QkRuler : public QWidget
{
Q_OBJECT
public:
QkRuler(QWidget *parent = nullptr);
~QkRuler() override;
protected:
void keyReleaseEvent(QKeyEvent *event) override;
void paintEvent(QPaintEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
private:
void _appear();
void _initTray();
QPoint _handlePos();
QBitmap _handleMask();
bool _inHandleArea(QPoint pos);
void _highlightHandle(bool in);
void _updateWindowGeometry();
enum DragState
{
DragState_idle,
DragState_recognizing,
DragState_moving,
DragState_rotating,
DragState_resizing
};
GeometryCalculator m_geoCalc;
QPoint m_dragPosition;
int m_selectedTick;
bool m_handleHighlighted;
DragState m_dragState;
private slots:
void _reset();
void _about();
void iconActivated(QSystemTrayIcon::ActivationReason reason);
};
#endif // QKRULER_H