summaryrefslogtreecommitdiff
path: root/src/websnap.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-03-05 12:41:28 +0100
committerAndrea Diamantini <adjam7@gmail.com>2010-03-05 12:41:28 +0100
commit384b3f1d066443b67b9d3d6389846a44e976876f (patch)
treeb32cd9e54a5670dca86d47a8a8bce425f2241022 /src/websnap.cpp
parentStupid me, committed wrong change. Sorry :) (diff)
downloadrekonq-384b3f1d066443b67b9d3d6389846a44e976876f.tar.xz
Ok, things seem working well now.
Anyway, it needs some days of testing..
Diffstat (limited to 'src/websnap.cpp')
-rw-r--r--src/websnap.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/websnap.cpp b/src/websnap.cpp
index 2916418b..ceb24b4f 100644
--- a/src/websnap.cpp
+++ b/src/websnap.cpp
@@ -75,11 +75,14 @@ void WebSnap::load()
}
+// NOTE please, be careful modifying this.
+// You are playing with fire..
QPixmap WebSnap::renderPreview(const QWebPage &page, int w, int h)
{
// prepare page
page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
+ QSize oldSize = page.viewportSize();
// find the best size
QSize size;
@@ -90,7 +93,8 @@ QPixmap WebSnap::renderPreview(const QWebPage &page, int w, int h)
// create the page image
QImage pageImage = QImage(size, QImage::Format_ARGB32_Premultiplied);
- pageImage.fill(Qt::transparent);
+ pageImage.fill(Qt::transparent);
+
// render it
QPainter p(&pageImage);
page.mainFrame()->render(&p);
@@ -100,7 +104,8 @@ QPixmap WebSnap::renderPreview(const QWebPage &page, int w, int h)
// restore page settings
page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAsNeeded);
page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded);
-
+ page.setViewportSize(oldSize);
+
return QPixmap::fromImage(pageImage);
}