How to create transparent window in Linux
I am using below mention code Inside constructor of MainWindow class of my simple QtWidget application.
This makes my window background transparent in WINDOW.
But in Linux machine my window bg is totally black and on command prompt I am getting below mention message.
“QGtkStyle was unable to detect the current GTK+ theme.”
Please help whats going wrong in Linux machine
anselmolsm last edited by
Could you please describe your environment? For example, are you running Gnome, Unity, etc? It can help me and other people to find what is the cause of your problem.
Maybe it is not the same case, but some colleagues experienced this issue when their gnome environments were with desktop effects disabled.
Also, check if this issue happens when you use another style. Do the following: Run your app in the command line with the argument "-style <another style> ", where another style can be motif, plastique, cleanlooks, etc.
lgeyer last edited by
Be aware that your code is currently clearing out any set window flags besides Qt::FramelessWindowHint.
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
In addition, make sure your X server supports ARGB visuals and you're having a compositing window manager.
Thanks for your replies.
I have checked my Linux environment details, below are the inputs:-
- I am using GNome desktop environment in my Suse Linux.
- I have checked by executing the app from command line by specifying various style flags but still black window.
Note :- if I am not using any style flag from command line , I am getting the below mention message
"lib: extension "RANDR" missing on display ":12.0".
but after using any of the style suggested by you , now this message is not coming.
- I have ensured that none of other flags apart from FramelessWindowsHint is enabled by using the
code suggested as
@setWindowFlags(windowFlags() | Qt::FramelessWindowHint);@
I found very interesting post at below mention location about transparency effect on X11.
I guess Lukas is very near to the root cause if the prob.
I checked in my application using following code
and it returned false, means I am not running Composite Manager and I dont know how to enable ARGB visuals for X11.
First time in my life I am touching Linux machine.
Guyz please help me how to enable ARGB visuals and Composite manager.
Gitesh Yeole last edited by
Any further update on this ?
I also have same question how to enable ARGB visuals and Composite manager ????