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. Two GraphicsEffects for one QWidget?
Forum Updated to NodeBB v4.3 + New Features

Two GraphicsEffects for one QWidget?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.5k 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.
  • S Offline
    S Offline
    Sebbo
    wrote on last edited by Sebbo
    #1

    Hi,

    is it possible to apply two different QPropertyAnimations to one QWidget?
    I'd like to visualize QPushButtons with a dropshadow as well as be able to change the opacity while states are changing.

    QGraphicsOpacityEffect* opacity = new QGraphicsOpacityEffect();
    opacity->setOpacity(0.5);
    pushButton->setGraphicsEffect(opacity);
    

    and

    QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect();
    shadow->setBlurRadius(8);
    shadow->setOffset(2, 2);
    pushButton->setGraphicsEffect(shadow);
    

    I only get the last one working which has be applied. Is there a way to apply both effects at the same time?
    Any help is much appreciated!

    Thanks

    S 1 Reply Last reply
    0
    • S Sebbo

      Hi,

      is it possible to apply two different QPropertyAnimations to one QWidget?
      I'd like to visualize QPushButtons with a dropshadow as well as be able to change the opacity while states are changing.

      QGraphicsOpacityEffect* opacity = new QGraphicsOpacityEffect();
      opacity->setOpacity(0.5);
      pushButton->setGraphicsEffect(opacity);
      

      and

      QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect();
      shadow->setBlurRadius(8);
      shadow->setOffset(2, 2);
      pushButton->setGraphicsEffect(shadow);
      

      I only get the last one working which has be applied. Is there a way to apply both effects at the same time?
      Any help is much appreciated!

      Thanks

      S Offline
      S Offline
      samdol
      wrote on last edited by
      #2

      @Sebbo said in Two GraphicsEffects for one QWidget?:

      QGraphicsDropShadowEffect

      I have tried before to have two Dropshadow effects on one QGraphicsView. But I also failed. I could get only one effect. As far as I remember, when I googled it, the result was negative.
      In Qt document
      Sets effect as the widget's effect. If there already is an effect installed on this widget, QWidget will delete the existing effect before installing the new effect.
      Check out
      http://stackoverflow.com/questions/27936950/applying-qgraphicsdropshadoweffect-more-than-once-crashes-the-app

      S 1 Reply Last reply
      2
      • S samdol

        @Sebbo said in Two GraphicsEffects for one QWidget?:

        QGraphicsDropShadowEffect

        I have tried before to have two Dropshadow effects on one QGraphicsView. But I also failed. I could get only one effect. As far as I remember, when I googled it, the result was negative.
        In Qt document
        Sets effect as the widget's effect. If there already is an effect installed on this widget, QWidget will delete the existing effect before installing the new effect.
        Check out
        http://stackoverflow.com/questions/27936950/applying-qgraphicsdropshadoweffect-more-than-once-crashes-the-app

        S Offline
        S Offline
        Sebbo
        wrote on last edited by
        #3

        @samdol
        Well that's disappointing.. guess I have to come across with a neat idea myself. :)
        Anyways, thank you very much for your quick reply!!!
        Cheers

        1 Reply Last reply
        0
        • BuckwheatB Offline
          BuckwheatB Offline
          Buckwheat
          wrote on last edited by
          #4

          @samdol... since the key is the QGraphicsEffect parent class, have you tried deriving a new combined or creating a QGraphicsEffectGroup that allows you to add multiple groups? This seems like it would be a good solution for your needs.

          Dave Fileccia

          1 Reply Last reply
          0
          • BuckwheatB Offline
            BuckwheatB Offline
            Buckwheat
            wrote on last edited by
            #5

            This was really meant for @Sebbo ! Typo

            Dave Fileccia

            S 1 Reply Last reply
            0
            • BuckwheatB Buckwheat

              This was really meant for @Sebbo ! Typo

              S Offline
              S Offline
              Sebbo
              wrote on last edited by
              #6

              @Buckwheat
              Sorry for the late reply. Didn't try to group the effects but solved the issue with applying new effects while being in different states. This was sufficient for my purposes.

              1 Reply Last reply
              1

              • Login

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