Blur everything below a widget
-
Hello, I'm currently writing an app in cpp and I have a QFrame that is above all other widgets in an absolute position. I would like to blur the translucent background of that widget so that everything below this widget appears blurred.
I tried just using QGraphicsEffect on my widget, but that blurred everything inside that widget, and not even anything that is viewable through its translucent background.Here is an image of what I mean to better visualize, everything viewable trough that widget should be blurred.
I've read that it's better to use QOpenGL or QGraphicsView, but I'm not sure how I would apply that to my current code.
-
I don't see anything blurred there?!
As @Chris-Kawa said here, this is not possible using Qt only.
You can blur the widget background itself, but not other apps or the OS background that shines through.You thought of something like this, right?
-
I don't see anything blurred there?!
I remove the code that blurred the entire thing, I just wanted to give everyone a picture of what I'm working on to so its easier to understand.
https://learn.microsoft.com/en-us/windows/apps/design/style/acrylic
I'm on linux and plan to be cross platform (only if windows or mac don't make my life hard).
On a note, I don't want to blur the Window, just the widget. Look at everything in the bordered widget, the background is translucent and should be blured.
-
@Crylia said in Blur everything below a widget:
I remove the code that blurred the entire thing, I just wanted to give everyone a picture of what I'm working on to so its easier to understand.
I mean, great that you want to show us your work, but when it comes to your question, it does not matter what your widget does or is. The question was how to blur the background.
I'm on linux and plan to be cross platform (only if windows or mac don't make my life hard).
It was just to figure out if we are talking about the same thing...
On a note, I don't want to blur the Window, just the widget. Look at everything in the bordered widget, the background is translucent and should be blured.
So it's the same. Doesn't matter if you want to blur a widget on top or below another.
In both ways you have to apply the blur and "transparent" effect.@Crylia said in Blur everything below a widget:
I tried just using QGraphicsEffect on my widget, but that blurred everything inside that widget, and not even anything that is viewable through its translucent background.
That's the point... because you can only blur the widget itself.
You can not set something like this "acrylic" filter as background of a Qt widget (which is what you need, I guess) -
@Crylia maybe this could be a good startpoint for you?https://github.com/jordanprog86/QtTransparentWindow
-
In order to do this entirely in Qt you could try to take a screenshot of the desktop (https://doc.qt.io/qt-6/qtwidgets-desktop-screenshot-example.html), blur the screenshot and use it as opaque background for your widget. This gets a little problematic if the background is constantly changing. (Maybe you get redraw request from the OS if you give your window just a tiny little bit of transparency.)
-
This is pain when you move the widget around very fast :D
It will take one screenshot and render the image for every moveEvent. I think it will be laggy as hell.