summaryrefslogtreecommitdiffstats
path: root/qt-ui/printdialog.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-06-21 04:59:15 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-07-05 20:58:16 +0300
commitbc0b443afd73e0bc7c18b293d051aa01bf82d99f (patch)
treefcdd14b41d11f9bdb4e88136a61f2e0dfb4102aa /qt-ui/printdialog.cpp
parent74e295698629f27178abac7fee0ac61fc80fc63d (diff)
downloadsubsurface-bc0b443afd73e0bc7c18b293d051aa01bf82d99f.tar.gz
Printing: add QPrintPreviewDialog to main dialog
Add preview dialog that shows the printer contents before printing. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'qt-ui/printdialog.cpp')
-rw-r--r--qt-ui/printdialog.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/qt-ui/printdialog.cpp b/qt-ui/printdialog.cpp
index 6f30f89f5..9949b104d 100644
--- a/qt-ui/printdialog.cpp
+++ b/qt-ui/printdialog.cpp
@@ -93,6 +93,11 @@ void PrintDialog::onFinished()
void PrintDialog::previewClicked(void)
{
+ QPrintPreviewDialog previewDialog(&qprinter, this, Qt::Window
+ | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint
+ | Qt::WindowTitleHint);
+ connect(&previewDialog, SIGNAL(paintRequested(QPrinter *)), this, SLOT(onPaintRequested(QPrinter *)));
+ previewDialog.exec();
}
void PrintDialog::printClicked(void)
@@ -115,5 +120,9 @@ void PrintDialog::printClicked(void)
void PrintDialog::onPaintRequested(QPrinter *printerPtr)
{
+ connect(printer, SIGNAL(progessUpdated(int)), progressBar, SLOT(setValue(int)));
+ printer->print();
+ progressBar->setValue(0);
+ disconnect(printer, SIGNAL(progessUpdated(int)), progressBar, SLOT(setValue(int)));
}
#endif