summaryrefslogtreecommitdiffstats
path: root/printer.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-08-14 21:37:12 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-08-15 15:05:22 +0300
commit5892fb576272214410764ea542189799d896e4bf (patch)
tree64cfc7e45de3e05fe5496e6cf1ffdbb393fb9fe3 /printer.cpp
parentf7fcc96bff2ca9965a4edfd61524a13cb5e2c183 (diff)
downloadsubsurface-5892fb576272214410764ea542189799d896e4bf.tar.gz
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>
Diffstat (limited to 'printer.cpp')
-rw-r--r--printer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/printer.cpp b/printer.cpp
index 5d7adcacc..b9f9b3363 100644
--- a/printer.cpp
+++ b/printer.cpp
@@ -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);