From 1c49081e9724db666070305bb57f829076a718fe Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Mon, 27 Apr 2009 14:29:13 +0200 Subject: Setting the print dialog to print pdf the QPrinter returns false on isValid() If the user passes QString() on printer name we can still be valid if the format is pdf/postscript. So test that. Reviewed-by: Trond Kjernaasen --- src/gui/painting/qprinter.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp index 4f3e71c..5161e32 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/gui/painting/qprinter.cpp @@ -834,11 +834,15 @@ void QPrinter::setPrinterName(const QString &name) #endif QList prnList = QPrinterInfo::availablePrinters(); - d->validPrinter = false; - for (int i = 0; i < prnList.size(); ++i) { - if (prnList[i].printerName() == name) { - d->validPrinter = true; - break; + if (name.isEmpty()) { + d->validPrinter = d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat; + } else { + d->validPrinter = false; + for (int i = 0; i < prnList.size(); ++i) { + if (prnList[i].printerName() == name) { + d->validPrinter = true; + break; + } } } -- cgit v0.12