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.
- AcrylicMaterial — a tiny
AcrylicMaterial.dllthat exports two C functions,setAcrylicEffect()andsetAeroEffect(). Both resolve the undocumentedSetWindowCompositionAttribute()fromuser32.dllat run time and push anACCENT_ENABLE_ACRYLICBLURBEHIND/ACCENT_ENABLE_BLURBEHINDpolicy onto anyHWND. - Demo — a
QWidgetthat callsLoadLibrary+GetProcAddresson the DLL, so a window can be blurred without any link-time dependency (the DLL only has to sit next to the executable or onPATH). - BlurEffect — the "equivalent" approach: a
QWidgetis lowered behind the content, painted with a background image and given aQGraphicsBlurEffect, 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.
| 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) |
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 ReleaseAcrylicMaterial.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.
- Product page: product.xmuli.tech
- Windows materials documentation: Acrylic · Mica
MIT © 2022-2025 Wengeng Zhang

