[Qt-interest] Make QWebFrame rendering fill entire viewport

Andre Somers andre at familiesomers.nl
Tue Jun 22 09:11:55 CEST 2010


Hi,

I am trying to render an area in my application through QWebFrame 
(QWebView is not an option, sorry). The problem is, that sometimes the 
contents are smaller than the area available to render in. I would like 
to have the contents stretch to fill the entire area, so that at least 
the background is painted properly.

I have searched the web, and I came up with this:
<html><body><div>blah blah blah</div></body></html>

css:
html, body {height:100%;}
div {contents-height: 100%;}

Unfortunately, that does not work.

Before rendering, i set the QWebPage::viewPort to match the area size 
that should be rendered like so:

(viewPortSize is a QSize, page is a QWebPage*)
         page->setViewportSize(viewPortSize);
         page->setPreferredContentsSize(viewPortSize);
         page->mainFrame()->render(painter, QWebFrame::ContentsLayer);

What am I missing?
Any suggestions on how to make this paint in the whole viewPortSize area 
would be highly appreciated!

André




More information about the Qt-interest-old mailing list