Printing: use pageRect() to support old QT versions

While calculating the page size use QPrinter::pageRect instead of
QPrinter::pageLayout which is added in QT 5.3 and is not supported in
earlier versions.

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-05 19:35:34 +02:00 committed by Lubomir I. Ivanov
parent 11841563d2
commit e2dcee55a3

View file

@ -144,8 +144,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
pageSize.setHeight(printerPtr->pageLayout().paintRect(QPageLayout::Inch).height() * dpi);
pageSize.setWidth(printerPtr->pageLayout().paintRect(QPageLayout::Inch).width() * dpi);
pageSize.setHeight(printerPtr->pageRect(QPrinter::Inch).height() * dpi);
pageSize.setWidth(printerPtr->pageRect(QPrinter::Inch).width() * dpi);
webView->page()->setViewportSize(pageSize);
webView->setHtml(t.generate());
if (printOptions->color_selected && printerPtr->colorMode()) {