diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2015-07-10 21:45:27 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2015-07-20 15:28:03 +0300 |
commit | d4382c7c4b802b030bab5e64de4b1641f603d543 (patch) | |
tree | 335bf7e56a091c7b7f52a0fb9598f90fbc58523c /printer.cpp | |
parent | 3a6963836682aa0e0e2825db4eaac7ea48a9939b (diff) | |
download | subsurface-d4382c7c4b802b030bab5e64de4b1641f603d543.tar.gz |
Printing: add preview to TemplateEdit dialog
Show QPixmap in QLabel, Use Printer class to render the Preview on
the QPixmap.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'printer.cpp')
-rw-r--r-- | printer.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/printer.cpp b/printer.cpp index c5867450f..7cef1104e 100644 --- a/printer.cpp +++ b/printer.cpp @@ -141,3 +141,18 @@ void Printer::print() int Pages = ceil(getTotalWork(printOptions) / (float)divesPerPage); render(Pages); } + +void Printer::previewOnePage() +{ + if (printMode == PREVIEW) { + TemplateLayout t(printOptions, templateOptions); + + pageSize.setHeight(paintDevice->height()); + pageSize.setWidth(paintDevice->width()); + webView->page()->setViewportSize(pageSize); + webView->setHtml(t.generate()); + + // render only one page + render(1); + } +} |