8

アプリケーションで SVG 図面を表示するには、GtGui.QgraphicsView、QtGui.QgraphicsScene、QtSvg.QgraphicsSvgItem を使用します。QsvgRenderer はアニメーション化された SVG 図面をサポートしているため、SVG ファイルにいくつかのアニメーション化された要素を統合しました。

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

Firefox では円は期待どおりに動作しますが、QgraphicsView ではアニメーション化されません。

だから私は「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> 

QgraphicsView と Firefox で動作します。私の問題は解決しましたが、理解したいと思います。この振る舞いを誰が説明できますか?

補足: QSvgRenderer.animated() は、最初のケースでは FALSE を返し、2 番目のケースでは TRUE を返します。

01.05.2014 編集: 最初に Linux (Ubuntu 13.10) で Python 3.3、Qt 4.8、および PyQt 4.10.4 を使用しました。Ubuntu 14.04 にアップグレードした後、Python 3.4、Qt 5.2.1、および PyQt 5.2.1 を試しました ( Qt 4.8 から 5.2 では、アプリケーションのコードにいくつかの変更が必要ですが、svg-files の xml-code には変更がありません)。QgraphicsView の動作は両方のバージョンで同じです。

4

0 に答える 0