Results 1 to 3 of 3

Thread: QWidget, QFrame and QDialog transparency

  1. #1
    Join Date
    Feb 2010
    Posts
    18
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    2

    Default QWidget, QFrame and QDialog transparency

    Hi, just a quick question.

    If I set my QFrame or QDialog stylesheet to include
    Qt Code:
    1. background-color:rgba(0,0,0,100);
    To copy to clipboard, switch view to plain text mode 
    and those objects have a parent, they are rendered with a semi-transparent black background which is fine.

    If I set my QWidget to have that stylesheet then the background is opaque.

    So I'm just wondering:

    1. What properties do those classes have that allows the alpha channel to work?
    2. Why is a parent needed for transparency?


    I'm not struggling with the code, just wondering that's all

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 106 Times in 103 Posts

    Default Re: QWidget, QFrame and QDialog transparency

    Parent isn't needed for transparency, but then you need translucent background attribute and frameless window hint set on that widget.
    Look up Qt::WA_TranslucentBackground in the documentation for more info.

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

    JonnyJP (16th February 2012)

  4. #3
    Join Date
    Feb 2010
    Posts
    18
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    2

    Default Re: QWidget, QFrame and QDialog transparency

    Cheers, I'll have a look at this also

Similar Threads

  1. Replies: 5
    Last Post: 5th January 2012, 23:15
  2. Replies: 1
    Last Post: 6th September 2011, 23:00
  3. QDialog to QWidget
    By baray98 in forum Qt Programming
    Replies: 2
    Last Post: 3rd June 2008, 08:55
  4. remove the top left icon on qwidget\qdialog
    By Equilibrium in forum Qt Programming
    Replies: 3
    Last Post: 9th November 2007, 03:40
  5. Confused QWidget and QDialog behavior
    By munna in forum Qt Programming
    Replies: 1
    Last Post: 9th December 2006, 13:14

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.