diff options
author | Thomas Zander <thomas.zander@trolltech.com> | 2009-04-27 12:29:13 (GMT) |
---|---|---|
committer | Thomas Zander <thomas.zander@trolltech.com> | 2009-04-27 13:16:20 (GMT) |
commit | 1c49081e9724db666070305bb57f829076a718fe (patch) | |
tree | f5aa9afd7d3cc2c1a0426643f1f253d993cbc83e /src/gui/painting | |
parent | 728a7c2e1fc20c482b737a7070bd71afdf8e7d64 (diff) | |
download | Qt-1c49081e9724db666070305bb57f829076a718fe.zip Qt-1c49081e9724db666070305bb57f829076a718fe.tar.gz Qt-1c49081e9724db666070305bb57f829076a718fe.tar.bz2 |
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
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qprinter.cpp | 14 |
1 files 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<QPrinterInfo> 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; + } } } |