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. Can I mix QGraphicsOpacityEffect with animation

Can I mix QGraphicsOpacityEffect with animation

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 501 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.
  • MihanM Offline
    MihanM Offline
    Mihan
    wrote on last edited by
    #1

    Hi
    I want to add animation to QGraphicsPixmapItem when it was added into the QGraphicsScene.
    For example, when I add a QGraphicsPixmapItem, it will be movedfrom pos1 to pos2 , or showed from opacity(0) to opacity(1)

    Regards
    Mihan

    jsulmJ 1 Reply Last reply
    0
    • MihanM Mihan

      Hi
      I want to add animation to QGraphicsPixmapItem when it was added into the QGraphicsScene.
      For example, when I add a QGraphicsPixmapItem, it will be movedfrom pos1 to pos2 , or showed from opacity(0) to opacity(1)

      Regards
      Mihan

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Mihan Should be possible with https://doc.qt.io/qt-5/animation.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      MihanM 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Mihan Should be possible with https://doc.qt.io/qt-5/animation.html

        MihanM Offline
        MihanM Offline
        Mihan
        wrote on last edited by Mihan
        #3

        @jsulm
        Oh maybe my description is not clear enough.

        {
            // here has a item ready to be added
            QGraphicsPixmapItem *item = new QGraphicsPixmapItem();
        
            //I add effect 
            QGraphicsOpacity *effect = new QGraphicsOpacity();
            item ->setGraphicsEffect(effect);
        
            // add animation
            QPropertyAnimation *animation = new QPropertyAnimation(effect, "opacity");
        
            //but I don't know when the item is showed so that I don't know when the animation should be started.
            //If it has a function like QWidget::showEvent(). I could override it.
        
        }
        

        Also I want to make a CMyGraphicsPixmapItem based on QGraphicsPixmapItem with QPropertyAnimation QGraphicsOpacity

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          Hi
          You can try to use ItemChange
          https://doc.qt.io/qt-5/qgraphicsitem.html#GraphicsItemChange-enum
          it has info about visibility via QGraphicsItem::ItemVisibleChange

          MihanM 1 Reply Last reply
          1
          • mrjjM mrjj

            Hi
            You can try to use ItemChange
            https://doc.qt.io/qt-5/qgraphicsitem.html#GraphicsItemChange-enum
            it has info about visibility via QGraphicsItem::ItemVisibleChange

            MihanM Offline
            MihanM Offline
            Mihan
            wrote on last edited by
            #5

            @mrjj
            Thank you , it should be what I need.

            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