-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
22 lines (18 loc) · 1.5 KB
/
test.cpp
File metadata and controls
22 lines (18 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <QApplication>
#include <QMainWindow>
#include <windows.h>
#include <dwmapi.h>
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
QMainWindow w;
w.setMinimumSize(400, 300);
w.setAttribute(Qt::WA_TranslucentBackground);
// Explicitly enforce native window frame
w.setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
HWND hwnd = reinterpret_cast<HWND>(w.winId());
int backdropType = 3; // 3 = Acrylic, 2 = Mica
DwmSetWindowAttribute(hwnd, 38, &backdropType, sizeof(backdropType));
w.setStyleSheet("QMainWindow { background: rgba(0,0,0,50); }");
w.show();
return a.exec();
}