Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsDropShadowEffect cut off by margin

QGraphicsDropShadowEffect cut off by margin

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 368 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    reonZ
    wrote on last edited by
    #1

    I am using a QScrollArea with a QVBoxLayout::setAlignment(Qt::AlignHCenter | Qt::AlignTop); so that everytime i add a QFrame 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 that QGraphicsDropShadowEffect was the only way to make it happen so i added background color to the QFrame 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: screenshot

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved