Use QPageSetupDialog dialog for "Print to pdf" mode.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-04-19 13:40:44 +03:00
parent c326a4cd75
commit fb39798b3c

View File

@ -385,20 +385,23 @@ void TableWindow::LayoutPrint()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TableWindow::PrintToPdf() void TableWindow::PrintToPdf()
{ {
// display print dialog and if accepted print
QPrinter printer; QPrinter printer;
printer.setCreator(qApp->applicationDisplayName()+" "+qApp->applicationVersion()); printer.setCreator(qApp->applicationDisplayName()+" "+qApp->applicationVersion());
printer.setDocName(fileName); printer.setDocName(fileName);
printer.setOutputFormat(QPrinter::PdfFormat);
const QString fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"), QPageSetupDialog dialog(&printer, this);
QDir::homePath()+"/"+this->fileName+".pdf", if ( dialog.exec() == QDialog::Accepted )
tr("PDF file (*.pdf)"));
if (not fileName.isEmpty())
{ {
printer.setOutputFileName(fileName); printer.setOutputFormat(QPrinter::PdfFormat);
printer.setResolution(static_cast<int>(VApplication::PrintDPI)); const QString fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"),
Print( &printer ); QDir::homePath()+"/"+this->fileName+".pdf",
tr("PDF file (*.pdf)"));
if (not fileName.isEmpty())
{
printer.setOutputFileName(fileName);
printer.setResolution(static_cast<int>(VApplication::PrintDPI));
Print( &printer );
}
} }
} }