Results 1 to 2 of 2

Thread: Transparency propagation question

  1. #1
    Join Date
    Jan 2006
    Posts
    6
    Thanks
    1

    Default Transparency propagation question

    Hello all,
    in my application i'd like to set opacity only to the top level window but not for childs widget.

    Reading the qt manual at http://doc.trolltech.com/4.5/qwidget.html seems that just add setAutoFillBackground to central widget to avoid propagation. It's correct?

    This is the example image from qt page:


    I wrote a test but not work:

    Qt Code:
    1. #include <QtGui>
    2. int main(int argc, char *argv[])
    3. {
    4. QApplication a(argc, argv);
    5.  
    6. QWidget widget;
    7. widget.setWindowOpacity(0.7);
    8. QGroupBox box("Hello Sample", &widget);
    9. box.setAutoFillBackground(true);
    10.  
    11. widget.show();
    12.  
    13. return a.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 

    where am I wrong?
    Thank you

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Transparency propagation question

    Opacity is always propagated to child widgets. The docs you mention are related to propagating the background, not opacity.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    gianpatt (1st October 2009)

Similar Threads

  1. Transparency ... Again
    By EricF in forum Qt Programming
    Replies: 4
    Last Post: 1st December 2007, 19:52
  2. Speed, transparency, and drop issues with QGraphicsView
    By jefferai in forum Qt Programming
    Replies: 16
    Last Post: 30th June 2007, 16: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.