mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
74e2956986
commit
bc0b443afd
1 changed files with 9 additions and 0 deletions
|
@ -93,6 +93,11 @@ void PrintDialog::onFinished()
|
||||||
|
|
||||||
void PrintDialog::previewClicked(void)
|
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)
|
void PrintDialog::printClicked(void)
|
||||||
|
@ -115,5 +120,9 @@ void PrintDialog::printClicked(void)
|
||||||
|
|
||||||
void PrintDialog::onPaintRequested(QPrinter *printerPtr)
|
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
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue