Printing: hide scrollbar from QWebview to fix padding issue

The vertical scrollbar was causing a default margin at the right most of
the page which corrupted the page layout calculations. By hidding the
vertical scrollbar the issue is fixed.

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-08 00:55:12 +02:00 committed by Lubomir I. Ivanov
parent dc56d1fa54
commit 636c26feed

View file

@ -149,6 +149,7 @@ void Printer::print()
pageSize.setHeight(printerPtr->pageRect(QPrinter::Inch).height() * dpi);
pageSize.setWidth(printerPtr->pageRect(QPrinter::Inch).width() * dpi);
webView->page()->setViewportSize(pageSize);
webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
webView->setHtml(t.generate());
if (printOptions->color_selected && printerPtr->colorMode()) {
printerPtr->setColorMode(QPrinter::Color);