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>
This commit is contained in:
Gehad elrobey 2015-08-15 22:51:29 +02:00 committed by Lubomir I. Ivanov
parent e86fd45efd
commit 67bfa9f968

View file

@ -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