FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
NetSpeed/WinTransparent.cpp at master · XMuli/NetSpeed · GitHub
XMuli
/
NetSpeed
Public
Notifications
You must be signed in to change notification settings
Fork
15
Star
70
Code
Issues
3
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
NetSpeed
/
WinTransparent.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (48 loc) · 1.58 KB
Breadcrumbs
NetSpeed
/
WinTransparent.cpp
Copy path
File metadata and controls
57 lines (48 loc) · 1.58 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
/
/ SPDX-SnippetCopyrightText: 2020-2025 Wengeng Zhan
g
//
SPDX-Author: Wengeng Zhang <xmulitech@gmail.com>
//
SPDX-License-Identifier: MIT
#
include
"
WinTransparent.h
"
#
include
<
QMouseEvent
>
#
include
<
QDebug
>
#
include
<
QBoxLayout
>
#
include
<
QGraphicsEffect
>
#
include
<
QGraphicsBlurEffect
>
WinTransparent::WinTransparent
(QWidget *parent)
: QWidget(parent)
, m_posStart(QPoint(
0
,
0
))
, m_isMoveWindow(
false
)
{
init
();
}
void
WinTransparent::init
()
{
setWindowFlags
(Qt::X11BypassWindowManagerHint);
//
x11 直接绘制,无边框,无影阴影,总是置顶
//
setAttribute(Qt::WA_TranslucentBackground);
//
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
//
setWindowFlags(windowFlags() | Qt::FramelessWindowHint /*| Qt::ToolTip | Qt::FramelessWindowHint | Qt::Dialog*/);
//
setWindowOpacity(1); // 透明度
//
resize(400, 600);
//
setAttribute(Qt::WA_TranslucentBackground);
//
QGraphicsBlurEffect *blur = new QGraphicsBlurEffect();
//
blur->setBlurRadius(0.5);
//
blur->setBlurHints(QGraphicsBlurEffect::QualityHint);
//
setGraphicsEffect(blur);
}
void
WinTransparent::mousePressEvent
(QMouseEvent *event)
{
if
(event->
button
() == Qt::LeftButton) {
m_isMoveWindow =
true
;
m_posStart = event->
pos
();
}
}
void
WinTransparent::mouseMoveEvent
(QMouseEvent *event)
{
if
(m_isMoveWindow)
move
(event->
pos
() - m_posStart +
pos
());
}
//
void WinTransparent::mouseReleaseEvent(QMouseEvent *event)
//
{
//
if (event->button() == Qt::LeftButton)
//
m_isMoveWindow = false;
//
qDebug()<<"--------------->111";
//
}
Back
|
FazBrowse Home
|
New Git URL