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. QPropertyAnimation on QGraphicsItem freezes app
Qt 6.11 is out! See what's new in the release blog

QPropertyAnimation on QGraphicsItem freezes app

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.2k Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi,

    I´m animating a QGraphicsItem with QPropertyAnimation. I´ve subclassed QGraphicsItem like it´s descriped in the docs (setting Q_PROPERTY etc.).

    If I put more than one of these animations into a QParallelAnimationGroup the CPU load is up to 25% and my whole application freezes for the time of the animation. If I replace the QGraphicsItem with a QPushbutton everything is fine.

    Code:
    @
    int Count =0;

    do
    {
    AnimatedGraphicsItem *aPStatus = new AnimatedGraphicsItem();
    m_scene->addItem(aPStatus);

    QPropertyAnimation *statusAni = new QPropertyAnimation(aPStatus,"pos");
    statusAni->setDuration(1600);
    statusAni->setStartValue(QPoint(0, 0));
    statusAni->setEndValue(QPoint(pB->pos().x() + 10, pB->pos().y() + 10));
    statusAni->setEasingCurve(QEasingCurve::InCurve);
    statusAni->setLoopCount(-1);
    m_GroupAnimStatus->addAnimation(statusAni);
    Count++;
    

    }while(Count < 3);

    m_GroupAnimStatus->start(QPropertyAnimation::DeleteWhenStopped);
    @

    I found some posts which descriped the same problem but none with a solution.

    Thanks and regards

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      I'm not sure but try setting "setCacheMode":http://qt-project.org/doc/qt-5/qgraphicsitem.html#setCacheMode to DeviceCoordinateCache.

      157

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Hi,

        thanks for your reply. I already set the CacheMode to DeviceCoordinateCache without success. Any further ideas?

        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