| 641 | } |
| 642 | |
| 643 | void PDFDocumentView::zoomFitWindow() |
| 644 | { |
| 645 | if (!scene()) |
| 646 | return; |
| 647 | |
| 648 | QGraphicsItem *currentPage = _pdf_scene->pageAt(_currentPage); |
| 649 | if (!currentPage) |
| 650 | return; |
| 651 | |
| 652 | QRectF rect(currentPage->sceneBoundingRect()); |
| 653 | // Add a margin of half the inter-page spacing around the page rect so |
| 654 | // scrolling by one such rect will take us to exactly the same area on the |
| 655 | // next page |
| 656 | qreal dx = _pdf_scene->pageLayout().xSpacing(); |
| 657 | qreal dy = _pdf_scene->pageLayout().ySpacing(); |
| 658 | rect.adjust(-dx / 2, -dy / 2, dx / 2, dy / 2); |
| 659 | |
| 660 | zoomToRect(rect); |
| 661 | } |
| 662 | |
| 663 | |
| 664 | void PDFDocumentView::zoomFitWidth() |
no test coverage detected