summaryrefslogtreecommitdiff
path: root/src/websnap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/websnap.cpp')
-rw-r--r--src/websnap.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/websnap.cpp b/src/websnap.cpp
index 29201215..1405fb6e 100644
--- a/src/websnap.cpp
+++ b/src/websnap.cpp
@@ -96,8 +96,12 @@ QPixmap WebSnap::render(const QWebPage &page, int w, int h)
QPixmap WebSnap::renderTabPreview(const QWebPage &page, int w, int h)
-{
- QPixmap pageImage = WebSnap::render(page, page.viewportSize().width()+17, page.viewportSize().height());
+{
+ QSize oldSize = page.viewportSize();
+ int width = page.mainFrame()->contentsSize().width();
+ page.setViewportSize(QSize(width, width * ((0.0 + h) / w)));
+ QPixmap pageImage = WebSnap::render(page, page.viewportSize().width(), page.viewportSize().height());
+ page.setViewportSize(oldSize);
return pageImage.scaled(w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}