QGraphicsDropShadowEffect cut off by margin
-
I am using a
QScrollArea
with aQVBoxLayout::setAlignment(Qt::AlignHCenter | Qt::AlignTop);
so that everytime i add aQFrame
in it, they just pile on top of each others without stretching.I wanted the
QFrame
to look detached from it and i thought using a boxshadow would be the best for it, i found out thatQGraphicsDropShadowEffect
was the only way to make it happen so i added background color to theQFrame
and added this bit:
QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect(this);
shadowEffect->setYOffset(4);
shadowEffect->setXOffset(2);
shadowEffect->setBlurRadius(10);
setGraphicsEffect(shadowEffect);
The shadow appears but i have a problem with margins and scrolling, the shadow will not appear because when scrolling it will stop at the very edge of the frame, making the shadow outside of the displayed area, same thing will happen with margins.
Here is a screenshot showing what happens with a margin-right:
As you can see, the shadow on the right is truncated because of the margin, also, if i were to reduce the window height and force the scroll bar to appear, scroll down to the maximum would just stop at the border itself, making the shadow not visible.