Results 1 to 3 of 3

Thread: How to Set Transparency for Child QWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2017
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default How to Set Transparency for Child QWidget

    I am using following code to set the transparency for child widget but the output is showing as full white.

    setAttribute(Qt::WA_NoSystemBackground, true);
    setAttribute(Qt::WA_TranslucentBackground, true);
    setAttribute(Qt::WA_PaintOnScreen);

    I set the opacity but nothing happen to QWidget.

    How to set transparency to child QWidget which derived from parent?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to Set Transparency for Child QWidget

    Is it a widget in a container widget ?
    or
    Is it the top level widget (window) ?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to Set Transparency for Child QWidget

    How to set transparency to child QWidget which derived from parent?
    At first I wanted to correct Santosh Reddy since you wrote "child widget" in your subject, but then I saw the statement I quoted which hints to the possibility you are using the word 'child' to describe a sub class - or - you are misusing the word derived?
    So at the moment I agree withe Santosh that its not clear what is your setup - could you elaborate a bit more?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. QWidget promotion with child widgets
    By Phlucious in forum Qt Programming
    Replies: 3
    Last Post: 22nd February 2012, 07:41
  2. QWidget, QFrame and QDialog transparency
    By JonnyJP in forum Qt Programming
    Replies: 2
    Last Post: 16th February 2012, 16:13
  3. Replies: 9
    Last Post: 8th November 2011, 15:54
  4. Replies: 1
    Last Post: 16th September 2010, 15:57
  5. Replies: 10
    Last Post: 17th August 2006, 15:12

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.