Skip to content

Commit

Permalink
Pan image when resizing window to maintain focal point
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpurcell committed Dec 27, 2024
1 parent 6af8963 commit a30e483
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/qvgraphicsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ void QVGraphicsView::resizeEvent(QResizeEvent *event)
return;

QGraphicsView::resizeEvent(event);

const QPoint sizeDelta = QRect(QPoint(), event->size()).bottomRight() - QRect(QPoint(), event->oldSize()).bottomRight();
scrollHelper->move(sizeDelta.toPointF() / -2.0);
fitOrConstrainImage();
}

Expand Down

0 comments on commit a30e483

Please sign in to comment.