Dear visitor, welcome to QtForum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
Animation not working
Hello,
This is my first post.
I am making a checkers games as a way to learn Qt. I haven't been able to get the checker piece to animate. I had it working at one point however I deleted and changed things around and it's not working. I suspect it has something to do with the way the view, main window, and scene is setup. I looked at the samples and worked from their. The relevant code is below. It compiles fine but nothing happens once it runs. On Windows 7 with VS2010.
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
void checkers_window::slot_move_item(QString& id, QPoint end) {
CPiece* piece;
QPoint result;
result = board_pos_to_pix(end);
piece = PieceMap.value(1);
//piece->setProperty("pos", end);
//doesn't work
QPropertyAnimation animation(piece, "pos");
animation.setDuration(1000);
animation.setStartValue(QPoint(piece->x(), piece->y()));
animation.setEndValue(end);
animation.setEasingCurve(QEasingCurve::InOutBack);
animation.start();
}
|
This post has been edited 1 times, last edit by "Proteus" (Aug 3rd 2011, 10:07pm) with the following reason: found mistake updating
Never mind, I found my mistake. I forgot to convert the board positions to pixels thus it was moving very slowly. Duh.