fix #58 PDF file extension

This commit is contained in:
Arin Alexander 2017-02-03 14:18:28 +03:00
parent f409f54e8f
commit 21b3f0e912

View File

@ -174,8 +174,12 @@ void PreviewReportWidget::print()
void PreviewReportWidget::printToPDF()
{
QString fileName = QFileDialog::getSaveFileName(this,tr("PDF file name"),"","PDF(*.pdf)" );
QString filter = "PDF (*.pdf)";
QString fileName = QFileDialog::getSaveFileName(this,tr("PDF file name"),"","PDF (*.pdf)");
if (!fileName.isEmpty()){
QFileInfo fi(fileName);
if (fi.suffix().isEmpty())
fileName+=".pdf";
QPrinter printer;
printer.setOutputFileName(fileName);
printer.setOutputFormat(QPrinter::PdfFormat);