Results 1 to 4 of 4

Thread: SVG Animation on QGraphicsScene

  1. #1
    Join Date
    Dec 2007
    Location
    London
    Posts
    206
    Thanks
    40
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default SVG Animation on QGraphicsScene

    Hi,

    I want to change the speed of a svg animation on QGraphicsScene.

    For testing, Ive added the following function to "SvgViewer app" in example applications of QtCreator :

    Qt Code:
    1. void SvgView::mousePressEvent(QMouseEvent *event)
    2. {
    3. qDebug()<<((QGraphicsSvgItem*)m_svgItem)->renderer()->framesPerSecond();
    4. ((QGraphicsSvgItem*)m_svgItem)->renderer()->setFramesPerSecond(0);
    5. }
    To copy to clipboard, switch view to plain text mode 

    Although the animation should stop after calling this; there is no change in the animation speed.

    What may be the problem here?

    Thanks in advance...
    Last edited by yagabey; 3rd September 2014 at 14:46.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: SVG Animation on QGraphicsScene

    What may be the problem here?
    I think a frame rate of zero is not valid for an animated SVG. If you want the animation to stop, you probably have to set the animated property to false. Simply setting the frame rate to zero must restore the default frame rate. At least that's my "between the lines" reading of the QSvgRenderer docs.

  3. #3
    Join Date
    Dec 2007
    Location
    London
    Posts
    206
    Thanks
    40
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: SVG Animation on QGraphicsScene

    Thanks for the reply. I have also tested fps values like "3" or "100" . None of them make any difference. And i also don't think that there is a setAnimadProperty like function in the api.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: SVG Animation on QGraphicsScene

    And i also don't think that there is a setAnimadProperty like function in the api.
    Yes, you are right. My mistake. Don't know how to help you otherwise.

Similar Threads

  1. Replies: 1
    Last Post: 8th September 2012, 05:08
  2. Replies: 1
    Last Post: 27th July 2012, 16:33
  3. animation in qt
    By rimie23 in forum Qt Programming
    Replies: 4
    Last Post: 6th May 2012, 11:09
  4. Replies: 1
    Last Post: 28th January 2012, 13:38
  5. qml animation
    By vinayaka in forum Qt Quick
    Replies: 2
    Last Post: 21st September 2011, 05:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.