mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:53:23 +00:00
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:
parent
f7fcc96bff
commit
5892fb5762
1 changed files with 7 additions and 0 deletions
|
@ -75,6 +75,10 @@ void Printer::flowRender()
|
||||||
// One more element can be placed
|
// One more element can be placed
|
||||||
end = dontbreakElement.geometry().y() + dontbreakElement.geometry().height();
|
end = dontbreakElement.geometry().y() + dontbreakElement.geometry().height();
|
||||||
} else {
|
} 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);
|
QRegion reigon(0, 0, pageSize.width(), end - start);
|
||||||
viewPort.setRect(0, start, pageSize.width(), end - start);
|
viewPort.setRect(0, start, pageSize.width(), end - start);
|
||||||
|
|
||||||
|
@ -91,6 +95,9 @@ void Printer::flowRender()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// render the remianing page
|
// 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);
|
QRegion reigon(0, 0, pageSize.width(), end - start);
|
||||||
webView->page()->mainFrame()->render(&painter, QWebFrame::ContentsLayer, reigon);
|
webView->page()->mainFrame()->render(&painter, QWebFrame::ContentsLayer, reigon);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue