Solved QGraphicsView: How to calculate the center?
I am looking for the best way to calculate the current center of a QGraphicsView instance. The way to set the center is very easy using the centerOn() method, but if I want to get the opposite action (to get the QPoint center value), how should I do it?
Thank you for any hint :)
raven-worx Moderators last edited by raven-worx
QRectF rect = view->scene()->sceneRect(); QPointF center = rect.center();
or do you mean the center on which the scene is currently scrolled?
QPointF sceneCenter = view->mapToScene( view->viewport()->rect().center() );