-
Notifications
You must be signed in to change notification settings - Fork 0
/
BasicWindow.h
52 lines (47 loc) · 1.35 KB
/
BasicWindow.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
#pragma once
#include"TitleBar.h"
#include"CommonUtils.h"
#include"NotifyManager.h"
#include<QDialog>
#include<QStyleOption>
#include<QApplication>
#include<QDesktopWidget>
class BasicWindow : public QDialog
{
Q_OBJECT
public:
BasicWindow(QWidget *parent=nullptr);
virtual ~BasicWindow();
public:
//加载样式表
void loadStyleSheet(const QString& sheetName);
//获取圆头像
QPixmap getRoundImage(const QPixmap& src, QPixmap& mask, QSize maskSize = QSize(0, 0));
private:
void initBackGroundColor();//初始化背景
protected:
void paintEvent(QPaintEvent* event);//绘图事件
void mousePressEvent(QMouseEvent* event);//鼠标按压事件
void mouseMoveEvent(QMouseEvent* event);//鼠标移动事件
void mouseReleaseEvent(QMouseEvent* event);//鼠标松开事件
protected:
void initTitleBar(ButtonType buttonType = MIN_BUTTON);
void setTitleBarTitle(const QString &title, const QString icon = "");
private slots:
void onShowClose(bool);
void onShowMin(bool);
void onShowHide(bool);
void onShowNormal(bool);
void onShowQuit(bool);
void onSignalSkinChanged(const QColor& color);
void onButtonMinClicked();
void onButtonRestoreClicked();
void onButtonMaxClicked();
void onButtonCloseClicked();
protected:
QPoint m_mousePoint;//鼠标位置
bool m_mousePressed;//鼠标是否按下
QColor m_colorBackGround;//背景色
QString m_styleName;//样式文件名称
TitleBar* m_titleBar;//标题栏
};