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. How to change size of QGraphicsDropShadowEffect

How to change size of QGraphicsDropShadowEffect

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 748 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.
  • dporobicD Offline
    dporobicD Offline
    dporobic
    wrote on last edited by
    #1

    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:

    4fd83569-f612-4a79-b3a7-4f8b3c16973f-image.png

    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?

    https://github.com/ksnip/ksnip

    N 1 Reply Last reply
    0
    • dporobicD dporobic

      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:

      4fd83569-f612-4a79-b3a7-4f8b3c16973f-image.png

      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?

      N Offline
      N Offline
      nanor
      wrote on last edited by
      #2

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

       QGraphicsDropShadowEffect *bodyShadow = new QGraphicsDropShadowEffect;
          bodyShadow->setBlurRadius(30);
          bodyShadow->setColor(QColor(0,0,0,160));
          bodyShadow->setOffset(0);
          ui->label_2->setGraphicsEffect(bodyShadow);
      
      1 Reply Last reply
      1
      • dporobicD Offline
        dporobicD Offline
        dporobic
        wrote on last edited by dporobic
        #3

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

        15616d28-f92d-4de0-8ebd-88cf7f3afe8b-image.png

        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?

        https://github.com/ksnip/ksnip

        N 1 Reply Last reply
        0
        • dporobicD dporobic

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

          15616d28-f92d-4de0-8ebd-88cf7f3afe8b-image.png

          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?

          N Offline
          N Offline
          nanor
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • dporobicD Offline
            dporobicD Offline
            dporobic
            wrote on last edited by
            #5

            @nanor that on the screenshot is already the maximum.

            https://github.com/ksnip/ksnip

            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