[Resolved] Strange Hover-Only transparency losing effects on a button



  • My Widget declares:

    @setAttribute(Qt::WA_NoSystemBackground);@

    In its paintEvent, I set:

    @painter.setOpacity(0.75);@

    This gives me the ability to project a png on its entire background with some transparency. This works well.

    Problem: I am adding a QPushButton with a transparent png on top of my widget. The opaque portion of the button's image (derived from Qt CSS) is shown correctly, and the transparent areas remain with my widgets' drawn background, which is already somewhat transparent. When I HOVER over the image, my css dictates that my QPushButton changes image. When that happens, the opaque portion of the button image is shown correctly, but for the transparent areas, it's as if my own widget is re-drawing the background image, only with full opacity.

    This happens only on Windows. On OS X is works fine. I was wondering whether there was a bug in Windows in that respect and if there's a workaround for it.



  • Turns out that while

    @setAttribute(Qt::WA_NoSystemBackground);@

    is good enough for OS X...

    On windows you should also add:

    @setAttribute(Qt::WA_TranslucentBackground);@

    That took care of it.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.