summaryrefslogtreecommitdiff
path: root/src/websnap.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-10-21 11:18:54 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-10-21 11:18:54 +0200
commit65385989ddf7850634e0f43148c5fcc42a5bf62f (patch)
treefe4fa226e425de6b06f8e6e73bbd7107b4ceafb6 /src/websnap.cpp
parentFix history actions update (diff)
downloadrekonq-65385989ddf7850634e0f43148c5fcc42a5bf62f.tar.xz
Me stupid.. fixing tab previews!
Diffstat (limited to 'src/websnap.cpp')
-rw-r--r--src/websnap.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/websnap.cpp b/src/websnap.cpp
index 5727bc6f..bb2baf49 100644
--- a/src/websnap.cpp
+++ b/src/websnap.cpp
@@ -74,7 +74,7 @@ void WebSnap::load()
}
-QPixmap WebSnap::renderPreview(const QWebPage &page,int w, int h)
+QPixmap WebSnap::renderPreview(const QWebPage &page,int w, int h, bool border)
{
// prepare page
page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); // Why it doesn't work with one setScrollBarPolicy?
@@ -105,6 +105,15 @@ QPixmap WebSnap::renderPreview(const QWebPage &page,int w, int h)
p.end();
pageImage = pageImage.scaled(w, h, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
+ // restore page settings
+ page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAsNeeded);
+ page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAsNeeded);
+ page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded);
+ page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded);
+
+ if(!border)
+ return QPixmap::fromImage(pageImage);
+
// background image
QSize fixedSize(w + 30, h + 26);
QImage backImage = QImage(fixedSize, QImage::Format_ARGB32_Premultiplied);
@@ -126,12 +135,6 @@ QPixmap WebSnap::renderPreview(const QWebPage &page,int w, int h)
pt.fillRect(resultImage.rect(), Qt::transparent);
pt.end();
- // restore page settings
- page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAsNeeded);
- page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAsNeeded);
- page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded);
- page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded);
-
return QPixmap::fromImage(resultImage);
}
@@ -145,7 +148,7 @@ void WebSnap::saveResult(bool ok)
return;
}
- m_image = renderPreview(m_page, WIDTH, HEIGHT);
+ m_image = renderPreview(m_page, WIDTH, HEIGHT, true);
emit finished();
}