First you don't have to call update if you alter an item, the scene makes that automatically. But you have to alter an item, you just alter a rect, which isn't connected to the item in any way! So do
item->setRect(200, 200, 300, 300);
QGraphicsRectItem *item = scene->addRect(*r, targetPen, targetBrush);
item->setRect(200, 200, 300, 300);
To copy to clipboard, switch view to plain text mode
Further for performance reasons create QRect on the stack. And better don't use QRect's x and y when using an item on scene. Define that using the items position (QGraphicsRectItem::setPos()).
Bookmarks