Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QGraphicsDropShadowEffect cut off by margin
reonZ last edited by
I am using a
QVBoxLayout::setAlignment(Qt::AlignHCenter | Qt::AlignTop);so that everytime i add a
QFramein it, they just pile on top of each others without stretching.
I wanted the
QFrameto look detached from it and i thought using a boxshadow would be the best for it, i found out that
QGraphicsDropShadowEffectwas the only way to make it happen so i added background color to the
QFrameand added this bit:
QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect(this);
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.