You are not logged in.

1

Monday, August 1st 2011, 3:34am

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


2

Wednesday, August 3rd 2011, 10:08pm

Never mind, I found my mistake. I forgot to convert the board positions to pixels thus it was moving very slowly. Duh.