Hi,

I'm trying to use the animation framework to animate a point of a line but I keep getting the error:
QPropertyAnimation: you're trying to animate a non-existing property pt1 of your QObject

Qt Code:
  1. class MyLine : public QGraphicsWidget {
  2. Q_PROPERTY(QPoint pt1 READ pt1 WRITE setPt1)
  3. public:
  4. QPoint pt1;
  5.  
  6. MyLine() {
  7. pt1 = *new QPoint(10, 10);
  8. }
  9.  
  10. void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) {
  11. painter->setPen(Qt::red);
  12. painter->drawLine(pt1, QPoint(100, 100));
  13. }
  14.  
  15. void setPt1(QPoint p) {
  16. pt1.setX(p.x());
  17. pt1.setY(p.y());
  18. }
  19. };
  20.  
  21. // Calling code is:
  22. QPropertyAnimation anim(&r, "pt1");
  23. anim.setDuration(4000);
  24. anim.setStartValue(QPoint(10, 10));
  25. anim.setEndValue(QPoint(100, 100));
  26. anim.start();
To copy to clipboard, switch view to plain text mode 

Can you tell me why am I getting this error? I'm also a c++ newbie so my use of pointers and so might be wrong...

Thanks!