diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2015-08-19 23:02:58 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2015-08-22 18:32:53 +0300 |
commit | afc697e7977590795b8d5c26a873d12d8f601104 (patch) | |
tree | 31cacc25da3c449a2815cc3546d3742247215c49 /printer.cpp | |
parent | 4a988aa8689835c4970645bc28d36ec9f5429f15 (diff) | |
download | subsurface-afc697e7977590795b8d5c26a873d12d8f601104.tar.gz |
Printing: refactor printing code
This section of the code is called only while rendering a flow layout
template, so move it to the flow layout function.
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 | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/printer.cpp b/printer.cpp index d0a165dcb..624de3a42 100644 --- a/printer.cpp +++ b/printer.cpp @@ -59,6 +59,11 @@ void Printer::putProfileImage(QRect profilePlaceholder, QRect viewPort, QPainter void Printer::flowRender() { + // add extra padding at the bottom to pages with height not divisible by view port + int paddingBottom = pageSize.height() - (webView->page()->mainFrame()->contentsSize().height() % pageSize.height()); + QString styleString = QString::fromUtf8("padding-bottom: ") + QString::number(paddingBottom) + "px;"; + webView->page()->mainFrame()->findFirstElement("body").setAttribute("style", styleString); + // render the Qwebview QPainter painter; QRect viewPort(0, 0, 0, 0); @@ -187,6 +192,7 @@ void Printer::print() return; } + QPrinter *printerPtr; printerPtr = static_cast<QPrinter*>(paintDevice); @@ -218,10 +224,6 @@ void Printer::print() } int Pages; if (divesPerPage == 0) { - // add extra padding at the bottom to pages with height not divisible by view port - int paddingBottom = pageSize.height() - (webView->page()->mainFrame()->contentsSize().height() % pageSize.height()); - QString styleString = QString::fromUtf8("padding-bottom: ") + QString::number(paddingBottom) + "px;"; - webView->page()->mainFrame()->findFirstElement("body").setAttribute("style", styleString); flowRender(); } else { Pages = ceil(getTotalWork(printOptions) / (float)divesPerPage); |