PDA

View Full Version : SVG Animation on QGraphicsScene



yagabey
3rd September 2014, 13:24
Hi,

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

For testing, Ive added the following function to "SvgViewer app (http://qt-project.org/doc/qt-5/qtsvg-svgviewer-example.html)" in example applications of QtCreator :


void SvgView::mousePressEvent(QMouseEvent *event)
{
qDebug()<<((QGraphicsSvgItem*)m_svgItem)->renderer()->framesPerSecond();
((QGraphicsSvgItem*)m_svgItem)->renderer()->setFramesPerSecond(0);
}

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...

d_stranz
3rd September 2014, 20:52
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.

yagabey
7th September 2014, 18:16
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.

d_stranz
8th September 2014, 18:53
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.