MCPcopy Create free account
hub / github.com/TeXworks/texworks / zoomFitWindow

Method zoomFitWindow

modules/QtPDF/src/PDFDocumentView.cpp:643–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641}
642
643void 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
664void PDFDocumentView::zoomFitWidth()

Callers 2

setDefaultScaleMethod · 0.80
maybeZoomToWindowMethod · 0.80

Calls 3

pageAtMethod · 0.80
xSpacingMethod · 0.80
ySpacingMethod · 0.80

Tested by

no test coverage detected