Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I assume that you are using the QGraphicsView framework (it would have been much easier to understand and debug your problem if you posted a minimal, running example program).</p> <p><s>I suggest to use <a href="http://doc.qt.nokia.com/qgraphicswidget.html" rel="nofollow">QGraphicsWidgets</a> and animate their <a href="http://doc.qt.nokia.com/qgraphicswidget.html#geometry-prop" rel="nofollow">"geometry" property</a> directly</s> (EDIT: I was wrong here, this cannot work).</p> <p>You need to simultaniously change the size and position without using two QPropertyAnimations. Most probably the easiest solution will be to <em>subclass</em> a QVariantAnimation (or even QVariantAnimation) and implement <code>updateCurrentValue()</code> appropriately. I think I would interpolate a QRectF from which you extract position and size/scale, otherwise you could of course just interpolate a float (which means you would have even more interpolation code to do yourself, but it gets around having to compute the scale from the size). Consider just marshalling the desired scale into the QRectF’s size (e.g. passing <code>QSizeF(scale, scale)</code> to the constructor). That is a little hackish, because the QRectF is /not/ the desired item geometry anymore, but is otherwise simple and works just great (also with easing curves). Here is a helpful snippet:</p> <pre><code>class GeometryAnimation(QtCore.QVariantAnimation): def __init__(self, item, parent = None): QtCore.QVariantAnimation.__init__(self, parent) self._item = item def updateCurrentValue(self, value): self._item.setPos(value.topLeft()) self._item.setScale(value.width()) </code></pre> <p>Why your current code does not work is hard to say and depends on the implementation of the "slideScale" property; if the transformations interact (which I would consider undesired behavior), that would be the cause.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload