summaryrefslogtreecommitdiffstats
path: root/src/printsupport/kernel/qprintengine_pdf.cpp
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2013-11-30 00:00:01 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-05 19:33:42 +0100
commit053bee8b80f4f987718c6633b831a58eb231b599 (patch)
tree06e23aa3565c31c61d50c80533b3454a68b6ed54 /src/printsupport/kernel/qprintengine_pdf.cpp
parentaae1eb3b03d0a0fff130dbba32e7e4250fb5df7f (diff)
QPrinter - Clean up Print Engine Key defaults and tests
The PrintEngine keys are not consistently treated across the platforms and are not properly tested. Start the process of making the print engines behave consistently by documenting and testing the current behavior. Ensure all unsupported features return a consistent default value. The auto test for valuePreservation() has been flaky depending on the platform and installed printers so remove it and replace it with more complete testing. If no native printers available then don't test the native engines. Fixes for the individual inconsistent keys will follow. Task-number: QTBUG-26430 Change-Id: Iab914d7e0a5ae4a2cdc24c8645751f0910cf440c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/printsupport/kernel/qprintengine_pdf.cpp')
-rw-r--r--src/printsupport/kernel/qprintengine_pdf.cpp42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/printsupport/kernel/qprintengine_pdf.cpp b/src/printsupport/kernel/qprintengine_pdf.cpp
index 7b3c3c1dac..f5c80b4cae 100644
--- a/src/printsupport/kernel/qprintengine_pdf.cpp
+++ b/src/printsupport/kernel/qprintengine_pdf.cpp
@@ -147,6 +147,28 @@ void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
Q_D(QPdfPrintEngine);
switch (int(key)) {
+
+ // The following keys are properties or derived values and so cannot be set
+ case PPK_PageRect:
+ break;
+ case PPK_PaperRect:
+ break;
+ case PPK_PaperSources:
+ break;
+ case PPK_SupportsMultipleCopies:
+ break;
+ case PPK_SupportedResolutions:
+ break;
+
+ // The following keys are settings that are unsupported by the PDF PrintEngine
+ case PPK_CustomBase:
+ break;
+ case PPK_PaperName:
+ break;
+ case PPK_WindowsPageSize:
+ break;
+
+ // The following keys are properties and settings that are supported by the PDF PrintEngine
case PPK_CollateCopies:
d->collate = value.toBool();
break;
@@ -216,8 +238,7 @@ void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
d->pageMarginsSet = true;
break;
}
- default:
- break;
+ // No default so that compiler will complain if new keys added and not handled in this engine
}
}
@@ -227,6 +248,20 @@ QVariant QPdfPrintEngine::property(PrintEnginePropertyKey key) const
QVariant ret;
switch (int(key)) {
+
+ // The following keys are settings that are unsupported by the PDF PrintEngine
+ // Return sensible default values to ensure consistent behavior across platforms
+ case PPK_CustomBase:
+ // Special case, leave null
+ break;
+ case PPK_PaperName:
+ ret = QString();
+ break;
+ case PPK_WindowsPageSize:
+ // Special case, leave null
+ break;
+
+ // The following keys are properties and settings that are supported by the PDF PrintEngine
case PPK_CollateCopies:
ret = d->collate;
break;
@@ -307,8 +342,7 @@ QVariant QPdfPrintEngine::property(PrintEnginePropertyKey key) const
ret = margins;
break;
}
- default:
- break;
+ // No default so that compiler will complain if new keys added and not handled in this engine
}
return ret;
}