Results 1 to 3 of 3

Thread: set transparent background for custom widget is not effective

  1. #1
    Join Date
    Oct 2010
    Posts
    12
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default set transparent background for custom widget is not effective

    hello, I made a custom widget named PopUpIrregularWidget, I want to make this customed widget has transparent background, and I use the code
    Qt Code:
    1. this->setStyleSheet("PopUpIrregularWidget{background : transparent;}");
    To copy to clipboard, switch view to plain text mode 
    , but the background is white, not transparent.
    So how to make the custom widget background transparent?
    or I lost something ?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: set transparent background for custom widget is not effective

    What is PopUpIrregularWidget? Base class? Have you reimp the paint event? Try to use QPalette.

  3. #3
    Join Date
    Oct 2010
    Posts
    12
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: set transparent background for custom widget is not effective

    The PopUpIrregularWidget just extends QWidget, a custom QWidget.And I use the code
    Qt Code:
    1. style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
    To copy to clipboard, switch view to plain text mode 
    in the paintEvent.

Similar Threads

  1. Replies: 2
    Last Post: 6th October 2010, 14:25
  2. Custom QRubberBand with transparent background
    By mdomke in forum Qt Programming
    Replies: 1
    Last Post: 11th June 2010, 10:34
  3. Draw transparent SVG in Background of Widget
    By soul_rebel in forum Qt Programming
    Replies: 0
    Last Post: 28th October 2008, 20:44
  4. Semi-Transparent Background on Widget?
    By JimDaniel in forum Qt Programming
    Replies: 3
    Last Post: 16th January 2008, 18:19
  5. transparent background of the main widget
    By nagpalma in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2007, 17:52

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
  •  
Qt is a trademark of The Qt Company.