-
Notifications
You must be signed in to change notification settings - Fork 2
/
widget.h
130 lines (106 loc) · 2.75 KB
/
widget.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef WIDGET_H
#define WIDGET_H
#pragma once
#include "longstory.h"
#include <QWidget>
QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE
class Widget : public QWidget
{
Q_OBJECT
public:
Widget();
~Widget();
private:
void InitUI();
void BorderRadius();
void InitStyle(int i);
void InitTrayIcon();
void InitLoadFont();
void createHorizontalGroupBox();
void createVerticalGroupBox();
void InitConnection();
void RefreshTime();
void EnterAnimation(QObject *obj, QRect rect = {0,0,0,0});
void LeaveAnimation(QObject *obj, QRect rect = {0,0,0,0});
void changeColor();
void smallToBigFont(int);
SHOWSOUCETYPE getChoicedItem();
QString getChoicedFont();
private:
// 重写键盘事件
void keyPressEvent(QKeyEvent *e);
// 绘图
void paintEvent(QPaintEvent *e);
// 鼠标进入事件
void enterEvent(QEvent *e);
// 鼠标离开事件
void leaveEvent(QEvent *e);
// 鼠标按下事件
void mouseDoubleClickEvent(QMouseEvent *e);
// 关闭时间
// void closeEvent(QCloseEvent *e);
private:
// 拖动事件
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
private:
bool isPressedWidget; // 界面移动问题
// 控件
QLabel *m_lab_Text;
QLCDNumber *m_LCD_Hour;
QLCDNumber *m_LCD_Min;
QLCDNumber *m_LCD_Sec;
// 布局相关
QGroupBox *m_hbl_Time;
QGroupBox *m_vbl_Main;
// 窗口拖动
QPoint m_lastPos;
// 系统托盘
QSystemTrayIcon *m_SysTrayIcon;
QMenu *m_menu;
QAction *m_action_time;
QAction *m_action_source;
QAction *m_action_about;
QAction *m_action_color;
QAction *m_action_exit;
QAction *m_action_LCDColor;
QAction *m_action_font;
QAction *m_action_fontColor;
// 动效
QPropertyAnimation *m_animation;
// LCD 颜色
QColor m_LCD_color;
// 字体
QString m_fontFamily;
QString m_FontColor;
int m_nSetFontSize;
int m_nw;
int m_nh;
// 判断切换过程
int m_nSwitchStatus; // 等于0即可切换
bool m_bswitch;
bool m_bActionSwitchColor;
bool m_bFontAutoColorSwitch;
// oneFromType
SHOWSOUCETYPE m_enuSourceType;
signals:
public slots:
void slot_activeTray(QSystemTrayIcon::ActivationReason reason);
void slot_showWindow();
void slot_changeWord();
void slot_changeTime();
void slot_showAbout();
void slot_changeFont();
void slot_autoChangeFontColor();
void slot_customChangeFontColor();
void slot_switchChangeColor();
void slot_switchChangeLCDColor();
void slot_changeSource();
void slot_exit();
private:
// Ui::Widget *ui;
};
#endif // WIDGET_H