I would like to get a semi-transparent blurred window in QML on Windows 10 similar to the Fluent Design guidelines (example). I know you can make a transparent window:
Window{
visible: true
color: "transparent"
}
but this doesn't achieve the blur effect I am looking at. I am also aware that one can blur elements inside the windows using QtGraphicalEffects
like FastBlur
but I would like to blur the entire window itself.
Is there a way to achieve this? I have also tried using the QtWinExtras
module and call QtWin::enableBlurBehindWindow
but this doesn't work either:
QObject *root = engine.rootObjects()[0];
QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
if (!window) {
qFatal("Error: Your root item has to be a window.");
return -1;
}
QtWin::enableBlurBehindWindow(window);
Ok so I found a solution that turned out to be easier than I thought it would be. Officially Microsoft does not provide an API to achieve what I was looking for. I stumbled across this thread and I found this. From there I adapted the code to my needs, I created a header file containing:
And then in my
main.cpp
:This enables the "Acrylic Material" effect I was looking for (in QML you have to set the window color to
"transparent"
).