-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColorWidget.h
65 lines (54 loc) · 1.37 KB
/
ColorWidget.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
#ifndef COLORWIDGET_H
#define COLORWIDGET_H
/**
* 屏幕拾色器 作者:feiyangqingyun(QQ:517216493) 2016-11-11
* 1. 鼠标按下实时采集鼠标处的颜色。
* 2. 实时显示颜色值。
* 3. 支持16进制格式和rgb格式。
* 4. 实时显示预览颜色。
* 5. 根据背景色自动计算合适的前景色。
*/
#include <QWidget>
#include <QSystemTrayIcon>
class QGridLayout;
class QVBoxLayout;
class QLabel;
class QLineEdit;
#ifdef quc
class Q_DECL_EXPORT ColorWidget : public QWidget
#else
class ColorWidget : public QWidget
#endif
{
Q_OBJECT
public:
static ColorWidget *Instance();
explicit ColorWidget(QWidget *parent = 0);
~ColorWidget();
private:
void InitTray();
protected:
void mousePressEvent(QMouseEvent *)override;
void mouseReleaseEvent(QMouseEvent *)override;
void closeEvent(QCloseEvent *event) override;
private:
static ColorWidget *instance;
QClipboard *cp;
bool pressed;
QTimer *timer;
QGridLayout *gridLayout;
QVBoxLayout *verticalLayout;
QLabel *labColor;
QLabel *label;
QLabel *labWeb;
QLineEdit *txtWeb;
QLabel *labRgb;
QLineEdit *txtRgb;
QLabel *labPoint;
QLineEdit *txtPoint;
QSystemTrayIcon* m_pSysTray = nullptr;
private Q_SLOTS:
void showColorValue();
void systemTrayIconActivated(QSystemTrayIcon::ActivationReason);
};
#endif // COLORWIDGET_H