What is QGraphicsmap and what is DiagramItem? How is the code you pasted related to the problem? You do realize the whole if block is a no-op, right?