Re: QGraphicsItem flickering
You are drawing outside your boundingRect(). Calling setPos() in the item constructor doesn't make much sense either.
Re: QGraphicsItem flickering
Do you mean adding adjust*2 when I specify rectf width and height?
Code:
QRectF BallItem
::boundingRect() const {
qreal adjust = 0.5;
QRectF rectf
= QRectF(-iRadius
-adjust,
-iRadius
-adjust, iRadius
*2 + adjust
*2 , iRadius*2 + adjust*2);
return rectf;
}
Re: QGraphicsItem flickering
Simplify the code (QRectF has a bunch of nice methods). And what's the purpose of calling setPos() in the constructor?
Re: QGraphicsItem flickering
I am going to rewrite it so it will look better.
If it comes to constructor, hmm well it is a remaining from my try-outs, setPos() is going to be removed. Now I know it is not the best way to do so, but when I started with QGraphics... stuff I didn't know that.