Skip to content

About

Qt 窗口透明磨砂:Win10 亚克力、Win11 云母、Win7 Aero 毛玻璃,附跨平台等效方案。 Acrylic, Mica and Aero Glass blur for Qt widgets, plus a cross-platform equivalent.

Topics

Resources

Stars

43 stars

Watchers

1 watching

Forks

Repository files navigation

AcrylicWindow

Qt C++ Platform License

English | 简体中文

Frosted-glass window backgrounds for Qt widgets on Windows — Windows 10 Acrylic, Windows 11 Mica and Windows 7 Aero Glass — plus a cross-platform trick that reproduces the same look without touching any OS API.

What's inside

  • AcrylicMaterial — a tiny AcrylicMaterial.dll that exports two C functions, setAcrylicEffect() and setAeroEffect(). Both resolve the undocumented SetWindowCompositionAttribute() from user32.dll at run time and push an ACCENT_ENABLE_ACRYLICBLURBEHIND / ACCENT_ENABLE_BLURBEHIND policy onto any HWND.
  • Demo — a QWidget that calls LoadLibrary + GetProcAddress on the DLL, so a window can be blurred without any link-time dependency (the DLL only has to sit next to the executable or on PATH).
  • BlurEffect — the "equivalent" approach: a QWidget is lowered behind the content, painted with a background image and given a QGraphicsBlurEffect, which yields a convincing frosted look on Linux and macOS too, where no such native API exists.
  • Live tuning — the BlurEffect demo ships a slider (0–200) to change the blur radius in real time and keeps a sharp copy for comparison.
  • One CMake project — library, blur demo and acrylic demo build together as three targets in C++17, verified with MSVC 2019 and Qt 6.8.

Materials per OS

OS Name Mechanism
Windows 7 Aero Glass QtWin::enableBlurBehindWindow() + QtWin::extendFrameIntoClientArea()
Windows 10 Acrylic Material SetWindowCompositionAttribute() with ACCENT_ENABLE_ACRYLICBLURBEHIND
Windows 11 Mica SetWindowCompositionAttribute() (same entry point, different accent policy)

Build

Requirements: CMake ≥ 3.20, Qt 5.15 or Qt 6.8 (Widgets), a C++17 compiler. The Aero Glass snippet additionally uses the QtWinExtras API (QtWin::enableBlurBehindWindow).

# Windows / Visual Studio 2019, 32-bit — same command as buildFromVS2019.bat
cmake -S . -B build -G "Visual Studio 16 2019" -A Win32
cmake --build build --config Release

AcrylicMaterial.dll is written to lib/, executables to bin/. Both demos read their background image by relative path, so run them from the expected working directory; if the blur does not appear, check the DLL path and the image path first.

Links

License

MIT © 2022-2025 Wengeng Zhang

About

Qt 窗口透明磨砂:Win10 亚克力、Win11 云母、Win7 Aero 毛玻璃,附跨平台等效方案。 Acrylic, Mica and Aero Glass blur for Qt widgets, plus a cross-platform equivalent.

Topics

Resources

Stars

43 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages