Appearance of lines on the trajectory of an animated object
Unsolved
General and Desktop
-
Hello, I have put an image in the background (on a graphicsView) and I want to move some coloured cubes on it. Unfortunately lines appear on the path.
Here is my code below :
animation = new QPropertyAnimation(ui->Cube1, "geometry"); animation->setDuration(10000); animation->setStartValue(ui->Cube1->geometry()); animation->setEndValue(QRect(600,700,60,60)); QEasingCurve curve; curve.setType(QEasingCurve::InQuad); animation->setEasingCurve(curve); animation->start();
Do you know how to solve this problem?
Thank you
-
One of the common causes for this problem is drawing outside of your item's bounding box e.g. with a code like
painter->fillRect(rect, color);
where rect is the bounding box given as a parameter to the drawing event callback. The right/bottom edge of the rectangle lies out of it, so you need to adjust for it when drawing e.g.
painter->fillRect(rect.adjusted(0,0,-1,-1), color);