Important: Please read the Qt Code of Conduct -

How to change size of QGraphicsDropShadowEffect

  • Is there a way to change the size of QGraphicsDropShadowEffect? The Size is the same as the image it's attached to just with an offset. What I would like to achieve is something like this:


    Left is plain QGraphicsDropShadowEffect, the shadow is below and right because there is an offset of 5px on x and y. On the right there is shadow on all sides, currently I can't figure out how to achieve this.
    An option is probably overwriting the draw method but how to draw this blurry shadow?

  • @dporobic Hi. Maybe using setBlurRadius and setOffset work, like the following code:

     QGraphicsDropShadowEffect *bodyShadow = new QGraphicsDropShadowEffect;

  • @nanor not a bad idea, that's what I get:


    Could be a bit darker I guess. I have tried playing around with the radius but that seems the best result I could get.

    Any other alternative?

  • @dporobic to get a darker shadow, you can increase the forth element of QColor (which is the opacity)

  • @nanor that on the screenshot is already the maximum.

Log in to reply