Results 1 to 3 of 3

Thread: transparent background of the main widget

  1. #1
    Join Date
    Apr 2007
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default transparent background of the main widget

    Hi ,

    The widget in the "analogclock" example is transparent with respect with my widget. But, how can i make my widget transparent with respect with my desktop? (My widget is the base widget for all the other widget including the widget in the "analogclock").

    I tryed to alter the widget's default palette with:

    Qt Code:
    1. QPalette p(palette());
    2. p.setColor ( QPalette::Window, Qt::transparent);
    3. setPalette(p);
    To copy to clipboard, switch view to plain text mode 
    but instead of a transparent background i got a black background !

    I don't understand what happened.

    Please, help me.

    Regards,
    Nuno

  2. #2
    Join Date
    Jan 2006
    Location
    Norway
    Posts
    124
    Thanked 38 Times in 30 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Smile Re: transparent background of the main widget

    Qt doesn't support this very well, because it doesn't work reliably on all platforms. On X11, you need the XComposite and XRender extensions for semitransparent windows, which is only supported in the very newest X servers, and it's most often disabled by default because of driver problems.

    Zack has got an example on his Dojo pages on Trolltech Labs that shows how you can make this work:

    http://labs.trolltech.com/page/Graph...ples/Examples1

    For your case, maybe you could just use a mask. You could capture child events for your top-level window, and set a custom mask based on the union of the regions of all immediate children...
    Bitto / Andreas Aardal Hanssen - andreas dot aardal dot hanssen at nokia
    Nokia Software Manager, Qt Development

  3. The following user says thank you to Bitto for this useful post:

    dotboy (2nd July 2009)

  4. #3
    Join Date
    Apr 2007
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: transparent background of the main widget

    Thanks Bitto for your advices.
    I'll try to configure X11 and then i'll give notices....

    Regards,
    Nuno

Similar Threads

  1. Replies: 15
    Last Post: 23rd March 2007, 16:16
  2. Replies: 4
    Last Post: 10th March 2007, 18:01
  3. Replies: 3
    Last Post: 8th December 2006, 18:51
  4. closing dialog in hidden main Widget
    By Lele in forum Qt Programming
    Replies: 3
    Last Post: 6th December 2006, 10:35
  5. Replies: 1
    Last Post: 5th April 2006, 16:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.