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();
}
|