Problem in making QWidget background transparent by setting WA_ContentsPropagated attribute.
I am loading a URL using QWebView(inherits QWidget), I would like to make the background of this widget transparent. As per the documentation at http://doc.qt.nokia.com/qq/qq16-background.html, I tried to set the attribute WA_ContentsPropagated for this widget but it is not working.
Sample code :-
QWebView* webView = new QWebView();
Please advice where I am going wrong.
[EDIT: code formatting, please wrap in @-tags, Volker]
I am amazed to see that in this world of qt developers does nodody know the answer for this.....
or atleast is it possible to give particular color and all that colored background will become transparent.
You did wait about a day - patience is a virtue!
We have holiday time in many parts of the world, so people are not in front of their workstations and answer developer's questions but sit together with their families.
Additionally, whining at your fellow developers is not very likely to make them eager to help you.
I have given a try by setting QPalette for this widget. Since as per Qt doc this is the basic interface for any bg, foregrond color related change.
while creating the Palette I have specifed brush as no brush and color as QColor which has alpha value as 0. Neverthless my widget is not becoming transparent but it is getting totally black.
Below mention is the code.
Maybe this "link":http://doc.qt.nokia.com/qq/qq16-background.html is helpful.
Thanks for suggestion. I have gone through this link multiple times , and got an idea that in Qt we can control color behaviour using QPalette, but not helping me . :(
Maybe "this":http://developer.qt.nokia.com/forums/viewthread/1107 one ? Just search this site for "transparent background". There are plenty threads about this.
Hats off to you man , I am able to achieve bg transparency by just three lines of code , mentioned in the link suggetsed by you.
Thank you very much for your timely help.
Glad I could help. The credit should go to the guy who actually provided the solution, I just remembered reading something about this a while ago.
I have just tested my transparency code in Suse Linux, which is having
Qt 4.6.3 run time libraries.
I am getting totally black window instead of transparent window and on commnad prompt
I am getting message as "QGtkStyle was unable to detect the current GTK+ theme."
Please help what is going wrong on Linux.
Am I missing some X11 related display driver on Linux machine