0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 00:54:39 +03:00

Preview printer initialization changed

This commit is contained in:
Arin Alexander 2019-02-21 19:21:09 +03:00
parent a010f2328c
commit fed80a8be1

View File

@ -208,29 +208,29 @@ void PreviewReportWidget::printPages(QPrinter* printer)
void PreviewReportWidget::print() void PreviewReportWidget::print()
{ {
if (m_defaultPrinter){ QPrinterInfo pi;
printPages(m_defaultPrinter); QPrinter lp(QPrinter::HighResolution);
} else {
QPrinterInfo pi; if (!pi.defaultPrinter().isNull()){
QPrinter printer(QPrinter::HighResolution);
if (!pi.defaultPrinter().isNull())
#ifdef HAVE_QT4 #ifdef HAVE_QT4
printer.setPrinterName(pi.defaultPrinter().printerName()); lp.setPrinterName(pi.defaultPrinter().printerName());
#endif #endif
#ifdef HAVE_QT5 #ifdef HAVE_QT5
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
printer.setPrinterName(pi.defaultPrinterName()); lp.setPrinterName(pi.defaultPrinterName());
#else #else
printer.setPrinterName(pi.defaultPrinter().printerName()); lp.setPrinterName(pi.defaultPrinter().printerName());
#endif #endif
#endif #endif
QPrintDialog dialog(&printer,QApplication::activeWindow());
if (dialog.exec()==QDialog::Accepted){
printPages(&printer);
}
} }
QPrinter* printer = m_defaultPrinter ? m_defaultPrinter : &lp;
QPrintDialog dialog(printer,QApplication::activeWindow());
if (dialog.exec()==QDialog::Accepted){
printPages(printer);
}
} }
void PreviewReportWidget::printToPDF() void PreviewReportWidget::printToPDF()