Quote Originally Posted by stella1016 View Post
Most of the time, the rectangle is painted correctly. But after resize, sometimes it will miss the red line boarder, for example the left-side edge is not painted.
Resize is the problem. When you resize graphics item and it has impact on boundingRect you have to call: QGraphicsItem::prepareGeometryChange (not inside boundingRect), see also QGraphicsItem::boundingRect.