summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qprinter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qprinter.cpp')
-rw-r--r--src/gui/painting/qprinter.cpp14
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;
+ }
}
}