diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2013-07-10 19:27:10 +0300 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2013-07-10 19:27:10 +0300 |
commit | 9dc45af915f2c8bc93703cbcc79ade1d3261e297 (patch) | |
tree | d9ec911acd138754a5c887bc3830d5804db3bfd8 /qt-ui/printdialog.cpp | |
parent | 20804b16d333f0a9d8b9f5e6eba05eddd60cc68e (diff) | |
download | subsurface-9dc45af915f2c8bc93703cbcc79ade1d3261e297.tar.gz |
Print: add a print preview for testing purposes
Use a QPrintPreviewDialog, while the print logic is WIP.
This way Qt will show the print output in a window instead
of exporting to a file and opending it manualy.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'qt-ui/printdialog.cpp')
-rw-r--r-- | qt-ui/printdialog.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/qt-ui/printdialog.cpp b/qt-ui/printdialog.cpp index 5652101ff..542590707 100644 --- a/qt-ui/printdialog.cpp +++ b/qt-ui/printdialog.cpp @@ -3,6 +3,7 @@ #include <QDebug> #include <QPushButton> #include <QVBoxLayout> +#include <QPrintPreviewDialog> PrintDialog *PrintDialog::instance() { @@ -43,9 +44,15 @@ void PrintDialog::runDialog() void PrintDialog::printClicked(void) { - // temporary - printer.setOutputFileName("print.pdf"); - printer.setOutputFormat(QPrinter::PdfFormat); - // --------- + // printer.setOutputFileName("print.pdf"); + // printer.setOutputFormat(QPrinter::PdfFormat); + // temporary: use a preview dialog + QPrintPreviewDialog previewDialog(&printer, this); + QObject::connect(&previewDialog, SIGNAL(paintRequested(QPrinter *)), this, SLOT(onPaintRequested(QPrinter *))); + previewDialog.exec(); +} + +void PrintDialog::onPaintRequested(QPrinter *printerPtr) +{ printLayout->print(); } |