| 718 | |
| 719 | |
| 720 | void PDFDocumentView::zoom100() |
| 721 | { |
| 722 | // Reset zoom level to 100% |
| 723 | |
| 724 | // Reset the view scale to 1:1. |
| 725 | QRectF unity = transform().mapRect(QRectF(0, 0, 1, 1)); |
| 726 | if (unity.isEmpty()) |
| 727 | return; |
| 728 | |
| 729 | // Set the transformation anchor to AnchorViewCenter so we always zoom out of |
| 730 | // the center of the view (rather than out of the upper left corner) |
| 731 | QGraphicsView::ViewportAnchor anchor = transformationAnchor(); |
| 732 | setTransformationAnchor(QGraphicsView::AnchorViewCenter); |
| 733 | scale(1 / unity.width(), 1 / unity.height()); |
| 734 | setTransformationAnchor(anchor); |
| 735 | |
| 736 | _zoomLevel = transform().m11(); |
| 737 | emit changedZoom(_zoomLevel); |
| 738 | } |
| 739 | |
| 740 | void PDFDocumentView::setMouseMode(const MouseMode newMode) |
| 741 | { |