Trouble animating line point
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
Code:
class MyLine : public QGraphicsWidget {
Q_PROPERTY(QPoint pt1 READ pt1 WRITE setPt1
) public:
MyLine() {
}
painter->setPen(Qt::red);
painter
->drawLine
(pt1,
QPoint(100,
100));
}
pt1.setX(p.x());
pt1.setY(p.y());
}
};
// Calling code is:
QPropertyAnimation anim(&r, "pt1");
anim.setDuration(4000);
anim.
setStartValue(QPoint(10,
10));
anim.
setEndValue(QPoint(100,
100));
anim.start();
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!