title: Animating a custom QGraphicsItem with QPropretyAnimation
body: <p>I want to make a car follow a path, so I tried animating a custom QGraphicsItem (describing a 'car') using QPropreties, starting by an example given on PySide documentation :</p>
  
  <pre><code>  self.anim = QtCore.QPropertyAnimation(self.car, "geometry")
    self.anim.setDuration(4000);
    self.anim.setStartValue(QtCore.QRect(0, 0, 100, 30));
    self.anim.setEndValue(QtCore.QRect(250, 250, 100, 30));
    self.anim.start();
  </code></pre>
  
  <p><code>self.car</code> here is an instance of Car, a class that inherits from <code>QGraphicsItem</code> and <code>QObject</code> ( <strong><em>EDIT</em></strong> Changed this, see <code>EDIT 2</code>):</p>
  
  <pre><code>class Car(QtGui.QGraphicsItem, QtCore.QObject):
  
          def __init__(self, map = None, ....):
  
              super(Car, self).__init__()
              self.map = map
                      ....
  </code></pre>
  
  <p>I always get the same error code when executing this :</p>
  
  <pre><code>  QPropertyAnimation::updateState (geometry): Changing state of an animation without target
  </code></pre>
  
  <p>This is weird as the target is really set ! I tried putting setTargetObject ( see the <a href="https://deptinfo-ensip.univ-poitiers.fr/ENS/pyside-docs/PySide/QtCore/QPropertyAnimation.html#PySide.QtCore.PySide.QtCore.QPropertyAnimation.propertyName" rel="nofollow">documentation on PySide</a> ) but it didn't change anything.</p>
  
  <p>Any idea about where that could come from ?</p>
  
  <p><em><strong>EDIT :</em></strong> Something that could help -> I tried putting those three lines and the result shows that the object is not taken into account :</p>
  
  <pre><code>  print self.car
    self.anim.setTargetObject(self.car)
    print self.anim.targetObject()
  </code></pre>
  
  <p>Result</p>
  
  <pre><code>&lt;engine.Car(this = 0x43f9200 , parent = 0x0 , pos = QPointF(0, 0) , z = 0 , flags =  ( ItemIsMovable | ItemIsSelectable ) )  at 0x1de0368&gt;
  None
  </code></pre>
  
  <p><em><strong>EDIT 2 :</em></strong> Changing the class inheritance to <code>QGraphicsObject</code> seems to have solved the 'no target' problem ! But I have a different error now (using a custom defined property 'pos'):</p>
  
  <pre><code>  QPropertyAnimation::updateState (pos, Car, ): starting an animation without end value
  </code></pre>
  
  <p>I defined my property that way :</p>
  
  <pre><code>def setPos(self, pos):
      self.x = pos[0]
      self.y = pos[1]
      self.update()
  
  def readPos(self):
      return (self.x, self.y)
  
  pp = QtCore.Property('tuple', readPos, setPos)
  </code></pre>