How can I darken the main window when the child dialog was showed
-
Hi
I want to make an effect like when Qt creator open the option dialog, the main window will be darkened.
I just think of a way that show another window with rgba:(0,0,0,0.6) in the main window, but it's so silly I think lol.
Could you give me some suggestions?Regards
Mihan -
@Mihan said in How can I darken the main window when the child dialog was showed:
I want to make an effect like when Qt creator open the option dialog, the main window will be darkened
On which platform is it like this? It's not like this on Linux/Windows.
-
@jsulm said in How can I darken the main window when the child dialog was showed:
It's not like this on Linux/Windows.
On Linux it's a window manager setting. E.g. openbox does this by default (and is imo very stressful for the eyes)
-
@Christian-Ehrlicher I use XFCE on Linux - it does not behave like this. But you're right - Linux isn't Linux :-)
-
@Mihan
Like me, you are using the GNOME window manager.I do not believe this has anything to do with your code or Qt. As others have said it should be purely window manager behaviour.
It should already be doing what you say you want. It does for me. All you have to do is do e.g.. a
QDialog::exec()
with your main window as the parent, and you should see it is "darkened" while your dialog is up-front.You should also be seeing this behaviour from other programs.
I bet you are using
nullptr
as the parent of your dialog? In that case it is "application" instead of "window" modal, and you won't see the darkening of the main window. Is that it?? :)