diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2015-08-14 22:24:48 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2015-08-15 15:05:26 +0300 |
commit | f3c5699714e43e91c8ff8f66119da454b314264d (patch) | |
tree | 170ff30f2fdb86de9428e211d1b155a032cce85d /printer.cpp | |
parent | 5892fb576272214410764ea542189799d896e4bf (diff) | |
download | subsurface-f3c5699714e43e91c8ff8f66119da454b314264d.tar.gz |
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>
Diffstat (limited to 'printer.cpp')
-rw-r--r-- | printer.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/printer.cpp b/printer.cpp index b9f9b3363..b0caa0815 100644 --- a/printer.cpp +++ b/printer.cpp @@ -194,8 +194,13 @@ void Printer::print() connect(&t, SIGNAL(progressUpdated(int)), this, SLOT(templateProgessUpdated(int))); dpi = printerPtr->resolution(); //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.setWidth(printerPtr->pageRect(QPrinter::Inch).width() * dpi); +#endif webView->page()->setViewportSize(pageSize); webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); // export border width with at least 1 pixel |