QGraphicsDropShadowEffect and Retina



  • I need to create a label that is visible on both dark and light backgrounds. The normal trick to doing this is to add a drop shadow to your text. For example, the text might be black, so you add a white drop shadow. This allows the text to be visible regardless of the background.

    So.... I decided to use QGraphicsDropShadowEffect. The problem is, when I use this on a label, the text becomes fuzzy on my Mac (i.e. no Retina support). Looks fine on Windows and Linux because they do not have HDPI needs. How do I work around this? It looks absolutely terrible on a Mac.

    Any other tricks to create a shadow around the text that might not need QGraphicsDropShadowEffect? I am open to that too.

    P.S. When does Qt plan to fully support Retina?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I don't have an answer to first question, that you should bring on the interest mailing list, you'll find Qt's developers/maintainers there (this forum is more user oriented)

    As for the second question, AFAIK, it's already supported on OS X and iOS, and currently in progress for the other platforms.

    By the way what version of Qt are you using ?



  • I am using 5.3, but its an issue with all of 5.X.

    Another issue that is really annoying, is that the @2x syntax doesn't work in the style sheets. So if you want to theme a widget, it becomes a real pain.

    They really need to think the syntax for HDPI because right now its very finicky. You do anything outside of the norm, and it all gets messed up.



  • Ok, so I added a \ to the @ symbol which worked, so you can do that to get the style sheet to load the image, but that image is also fuzzy... even with the @2x. So my guess is there currently is no support for High-DPI images with the style sheets.

    Is there a way to style the widgets manually without having to use the style sheets... because if there is a way, it might be possible to correct the problem that way.

    This also leads me to believe that there is only partial support for High-DPI at the moment... would be nice to know when full support is planned.



  • In case anyone else has this issue, I overloaded the QPainEvent for the widget I was trying to theme, did the drawing manually. It works fine that way, but its a lot of work. It would be great if the stylesheets just worked.

    I am going to look into how this would effect the text issue.



  • It looks like drawing text also works. Not sure how I am going to manually do the outline yet, but I'm sure I will work out the logic.


  • Lifetime Qt Champion

    Support in the style sheet might indeed be missing it uses a custom QStyle which might not yet be HDPI aware. You should have a look at the "bug report system":http://bugreports.qt-project.org to see if there's already something related. If not you should consider opening a report or feature request for that matter.

    For the discussion related to the HDPI support for all platforms you can have a look at the development mailing list archive from this month.



  • Awesome. I just sent out something to the mailing list about this, and I will look at the bug reports.

    Thanks for the advice.


  • Lifetime Qt Champion

    Did you register first before sending the email ?



  • no, so it's being held for review.


  • Lifetime Qt Champion

    IIRC, you can cancel that one, register and re-send the mail


Log in to reply
 

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