Never mind. I just realized that there is QGraphicsLayout that handles the layout for QGraphicsItems.