summaryrefslogtreecommitdiffstats
path: root/printer.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-08-15 22:51:29 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-08-22 18:30:32 +0300
commit67bfa9f96819ae3e2da07ff1413b90990fab745d (patch)
treeed12f00d28ffe8cc6ec8daba5a9313c79bf9fec9 /printer.cpp
parente86fd45efde7e8314b8045cb88495c48838bb4bd (diff)
downloadsubsurface-67bfa9f96819ae3e2da07ff1413b90990fab745d.tar.gz
Printing: use older Qt methods when calculating the ceil
Better portability for < Qt5.3. 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.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/printer.cpp b/printer.cpp
index b0caa0815..d0a165dcb 100644
--- a/printer.cpp
+++ b/printer.cpp
@@ -194,13 +194,8 @@ 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
+ pageSize.setHeight(std::ceil(printerPtr->pageRect(QPrinter::Inch).height() * dpi));
+ pageSize.setWidth(std::ceil(printerPtr->pageRect(QPrinter::Inch).width() * dpi));
webView->page()->setViewportSize(pageSize);
webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
// export border width with at least 1 pixel