mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:43:24 +00:00
Printing: remove silly white line at end of each page
QPrinter::pageRect() doesn't always return the correct value of the printable area, which results in white horizontal lines of un-rendered area at the bottom of each page, Use QPrinter::pageLayout() instead which fixes the issue. QPrinter::pageLayout() is added in QT 5.3, So use pageRect for previous versions. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
This commit is contained in:
parent
5892fb5762
commit
f3c5699714
1 changed files with 5 additions and 0 deletions
|
@ -194,8 +194,13 @@ void Printer::print()
|
||||||
connect(&t, SIGNAL(progressUpdated(int)), this, SLOT(templateProgessUpdated(int)));
|
connect(&t, SIGNAL(progressUpdated(int)), this, SLOT(templateProgessUpdated(int)));
|
||||||
dpi = printerPtr->resolution();
|
dpi = printerPtr->resolution();
|
||||||
//rendering resolution = selected paper size in inchs * printer dpi
|
//rendering resolution = selected paper size in inchs * printer dpi
|
||||||
|
#if QT_VERSION >= 0x050300
|
||||||
|
pageSize.setHeight(printerPtr->pageLayout().paintRectPixels(dpi).height());
|
||||||
|
pageSize.setWidth(printerPtr->pageLayout().paintRectPixels(dpi).width());
|
||||||
|
#else
|
||||||
pageSize.setHeight(printerPtr->pageRect(QPrinter::Inch).height() * dpi);
|
pageSize.setHeight(printerPtr->pageRect(QPrinter::Inch).height() * dpi);
|
||||||
pageSize.setWidth(printerPtr->pageRect(QPrinter::Inch).width() * dpi);
|
pageSize.setWidth(printerPtr->pageRect(QPrinter::Inch).width() * dpi);
|
||||||
|
#endif
|
||||||
webView->page()->setViewportSize(pageSize);
|
webView->page()->setViewportSize(pageSize);
|
||||||
webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
|
webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
|
||||||
// export border width with at least 1 pixel
|
// export border width with at least 1 pixel
|
||||||
|
|
Loading…
Add table
Reference in a new issue