aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Szymon Tomasz Stefanek2011-03-13 02:42:18 +0000
committerGravatar Szymon Tomasz Stefanek2011-03-13 02:42:18 +0000
commit1e363bf61495e9cfbfd53574e66f1c37ccb57a94 (patch)
treefc9441fa488220570a66571338da50d13b2cd32b /src/modules
parentMore work on kvs class webview (diff)
downloadKVIrc-1e363bf61495e9cfbfd53574e66f1c37ccb57a94.tar.gz
KVIrc-1e363bf61495e9cfbfd53574e66f1c37ccb57a94.tar.bz2
KVIrc-1e363bf61495e9cfbfd53574e66f1c37ccb57a94.zip
Fix the webView preview painting
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5569 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/objects/KvsObject_webView.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/modules/objects/KvsObject_webView.cpp b/src/modules/objects/KvsObject_webView.cpp
index 2f6f631db..a3e472d09 100644
--- a/src/modules/objects/KvsObject_webView.cpp
+++ b/src/modules/objects/KvsObject_webView.cpp
@@ -161,9 +161,21 @@ KVSO_CLASS_FUNCTION(webView,makePreview)
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setRenderHint(QPainter::TextAntialiasing, true);
painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
- painter.setClipRect(0,0,size.width(),768);
- painter.scale(0.20,0.34);
+ //painter.setClipRect(0,0,size.width(),size.height());
+ //painter.scale(0.20,0.34);
+ double dWScale = size.width() > 0 ? (212.0 / (double)(size.width())) : 0;
+ double dHScale = dWScale;
+ if((size.height() * dWScale) < 142)
+ {
+ // solution 1 is to fill the missing bacgkround
+ painter.fillRect(0,0,212,142,QColor(255,255,255));
+ // solution 2 is to stretch the contents, but this doesn't work well because
+ // the frame reports a size that doesn't exactly match the document
+ //dHScale = 142.0 / (double)(size.height());
+ }
+ painter.scale(dWScale,dHScale);
pFrame->documentElement().render(&painter);
+ //pFrame->render(&painter);
painter.end();
QPixmap *pPixmap=new QPixmap();
*pPixmap=pPixmap->fromImage(image);