Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How can I darken the main window when the child dialog was showed
Mihan last edited by Mihan
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?
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.
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 last edited by
JonB last edited by JonB
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
nullptras 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?? :)
gde23 last edited by
It also may depend if you use exec() or show() for the dialog, as well as what WindowFlags are set (blocking or non blocking dialog)