To show SVG-drawings in my application i use GtGui.QgraphicsView, QtGui.QgraphicsScene, QtSvg.QgraphicsSvgItem. Because QsvgRenderer supports animated SVG-Drawings i have integrated some animated elements in my SVG-files, e.g.:
<circle cx="x" cy="x" r="z" class="style">
<animate attributeName="r" attributeType="XML"
from="0"
to="z"
begin="0s"
dur="2s"
fill="remove"
restart="always"
repeatCount="indefinite"
end="indefinite"
/>
</circle>
in Firefox the circle acts as expected, in the QgraphicsView he is not animated.
So i tried 'animateTransform':
<circle cx="x" cy="x" r="z" class="style">
<animateTransform attributeName="transform" type="translate"
begin="0"
dur="2s"
from="x y" to="0 0"
...
additive="sum"
/>
<animateTransform attributeName="transform" type="scale"
begin="0"
dur="2s"
from="0" to="1"
…
additive="sum"
/>
</circle>
It works in QgraphicsView as well as in Firefox. My problem is solved, but i would like, to understand it. Who can explain this behavior?
Supplement: QSvgRenderer.animated() returns FALSE in first case, TRUE in second case.
edited 01.05.2014: First i used Python 3.3, Qt 4.8 and PyQt 4.10.4 on Linux (Ubuntu 13.10), after upgrading to Ubuntu 14.04 i tried Python 3.4, Qt 5.2.1 and PyQt 5.2.1 (because of the changes from Qt 4.8 to 5.2 are several modifications in the code of the application necessary, but not in the xml-code in the svg-files ), the behavior of QgraphicsView is in both versions the same.