Printing: fill the QPainter background color before rendering

While rendering a dynamically sized view port, it may not fit the full
page size, But the background color should be the same for the whole
page, So fill the page background color with the template background
color before rendering.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
This commit is contained in:
Gehad elrobey 2015-08-14 21:37:12 +02:00 committed by Lubomir I. Ivanov
parent f7fcc96bff
commit 5892fb5762

View file

@ -75,6 +75,10 @@ void Printer::flowRender()
// One more element can be placed
end = dontbreakElement.geometry().y() + dontbreakElement.geometry().height();
} else {
// fill the page with background color
QRect fullPage(0, 0, pageSize.width(), pageSize.height());
QBrush fillBrush(templateOptions->color_palette.color1);
painter.fillRect(fullPage, fillBrush);
QRegion reigon(0, 0, pageSize.width(), end - start);
viewPort.setRect(0, start, pageSize.width(), end - start);
@ -91,6 +95,9 @@ void Printer::flowRender()
}
}
// render the remianing page
QRect fullPage(0, 0, pageSize.width(), pageSize.height());
QBrush fillBrush(templateOptions->color_palette.color1);
painter.fillRect(fullPage, fillBrush);
QRegion reigon(0, 0, pageSize.width(), end - start);
webView->page()->mainFrame()->render(&painter, QWebFrame::ContentsLayer, reigon);