here i have a scene and a associated view ,then i hava a position in the scene coordinates.I want to set the center of the viewport with the position.How can i do it? I try
You need to set the transformation anchor mode of the graphics view to NoAnchor.
setTransformationAnchor(QGraphicsView::NoAnchor);
This prevents the graphics view from undoing the translation as expected by the other anchor modes (AnchorViewCenter, AnchorUnderMouse).