How to create transparent window in Linux
-
wrote on 6 Mar 2012, 11:55 last edited by
I am using below mention code Inside constructor of MainWindow class of my simple QtWidget application.
@setWindowFlags(Qt::FramelessWindowHint);
setStyleSheet("background:transparent;");
setAttribute(Qt::WA_TranslucentBackground);@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
-
wrote on 7 Mar 2012, 12:30 last edited by
Hi Ashish,
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.
-
wrote on 7 Mar 2012, 12:44 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. -
wrote on 7 Mar 2012, 14:46 last edited by
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);@
-
wrote on 7 Mar 2012, 15:59 last edited by
HI Guyz,
I found very interesting post at below mention location about transparency effect on X11.
http://stackoverflow.com/questions/7922177/qtwa-translucentbackground-available-everywhere
I guess Lukas is very near to the root cause if the prob.
I checked in my application using following code
@QX11Info::isCompositingManagerRunning()@
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.Please help!!!!!
Regards
Ashish -
wrote on 14 Jun 2019, 07:06 last edited by
Any further update on this ?
I also have same question how to enable ARGB visuals and Composite manager ????