Helpviewer/HelpSnap.py

changeset 2999
28c75409a78f
parent 2302
f29e9405c851
child 3057
10516539f238
child 3160
209a07d7e401
equal deleted inserted replaced
2998:95581102e03e 2999:28c75409a78f
22 @return preview pixmap (QPixmap) 22 @return preview pixmap (QPixmap)
23 """ 23 """
24 oldSize = page.viewportSize() 24 oldSize = page.viewportSize()
25 width = page.mainFrame().contentsSize().width() 25 width = page.mainFrame().contentsSize().width()
26 page.setViewportSize(QSize(width, int(width * h / w))) 26 page.setViewportSize(QSize(width, int(width * h / w)))
27 pageImage = __render(page, page.viewportSize().width(), page.viewportSize().height()) 27 pageImage = __render(page, page.viewportSize().width(),
28 page.viewportSize().height())
28 page.setViewportSize(oldSize) 29 page.setViewportSize(oldSize)
29 return pageImage.scaled(w, h, Qt.IgnoreAspectRatio, Qt.SmoothTransformation) 30 return pageImage.scaled(
31 w, h, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
30 32
31 33
32 def __render(page, w, h): 34 def __render(page, w, h):
33 """ 35 """
34 Private function to render a pixmap of given size for a web page. 36 Private function to render a pixmap of given size for a web page.

eric ide

mercurial