Results 1 to 5 of 5

Thread: Transparency ... Again

  1. #1
    Join Date
    Oct 2007
    Location
    Quebec, Canada
    Posts
    40
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy Transparency ... Again

    Hi,

    I searched and read alot of threads that talked about transparency. I actually tried lots of solution provided and then I ask you this :

    What I want to achieve is a semi-transparent top level window with opaque or different transparency level children.

    Now here's what I tried:

    - setWindowOpacity() this is good but apply to children too so not what I want.
    - Fill a QPixmap with Qt::Transparent and draw the pixmap and then draw other controls. This gives me the usual gray window without transparency.
    - QPainter::setOpacity before QPainter::fillRect with an opaque color or only fillRect with a transparent color.

    The latter two works if the floating window is a child of a main window but obviously, it get clipped if I try to move it outside of the main window.

    Any way of doing it ? I'm using Qt 4.3.2 and Windows XP.


    Another question unrelated. I tried setting backroung role like :

    mainWindow->setBackgroundRole( QPalette:: Dark ); on my mainwindow and this doesn't do anything, any hints ?

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Transparency ... Again

    On XP, your only solution is this:http://www.qtcentre.org/forum/f-qt-s...sses-9301.html (I'm pretty sure I suggested this link to you before...)

  3. #3
    Join Date
    Oct 2007
    Location
    Quebec, Canada
    Posts
    40
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Transparency ... Again

    I don't remember you suggesting that to me ...

  4. #4
    Join Date
    Sep 2007
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Transparency ... Again

    Grabing the content below the window via QPixmap::grabWidget() or QPixmap::grabWindow() and drawing this as background applied with an alpha might be a workaround.

    Sven

  5. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Transparency ... Again

    Quote Originally Posted by svenflossmann View Post
    Grabing the content below the window via QPixmap::grabWidget() or QPixmap::grabWindow() and drawing this as background applied with an alpha might be a workaround.

    Sven
    The performance would suck. There are platform dependent solutions that do exactly just that, but only much faster.

Similar Threads

  1. Speed, transparency, and drop issues with QGraphicsView
    By jefferai in forum Qt Programming
    Replies: 16
    Last Post: 30th June 2007, 16:14
  2. background transparency
    By hma in forum Qt Programming
    Replies: 2
    Last Post: 4th April 2007, 07:22
  3. multi pixmap transparency
    By bluesguy82 in forum Qt Programming
    Replies: 3
    Last Post: 21st August 2006, 22:13
  4. [QT3+XP] transparency and mouse tracking
    By incapacitant in forum Newbie
    Replies: 9
    Last Post: 17th February 2006, 18:49
  5. transparency
    By roms18 in forum Qt Programming
    Replies: 2
    Last Post: 16th February 2006, 19:38

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.