path: root/src/plugins/printsupport
diff options
authorJohn Layt <>2013-12-30 18:04:40 +0100
committerThe Qt Project <>2014-03-17 13:46:10 +0100
commitdbc50e06df8465e6de02ac0b4458e1a3f3f8568c (patch)
tree58375129a608575a7b99e6a3167baa668c9d7c25 /src/plugins/printsupport
parent70081096a152d6973d85a1c1466bbc058fe0b24b (diff)
QPrinter - Use QPageSize and QPageLayout
Use QPageSize and QPageMargins to get/set values in the print engines, add api to directly set the values, and rewrite the docs to make the paper-based api obsolete instead of the page-based api. Add new PPK keys to pass QPageSize, QPageMargins and QPageLayout to the print engines to ensure no level of detail is lost, e.g. for custom sizes passed to QPrinter. [ChangeLog][QtPrintSupport][QPrinter] QPrinter can now use QPageSize and QPageLayout in the public api to control the page layout for a print job. Change-Id: Iee39a4042bcd6141d29b0a82b49066d7a7a78120 Reviewed-by: Lars Knoll <>
Diffstat (limited to 'src/plugins/printsupport')
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/printsupport/cups/qcupsprintengine.cpp b/src/plugins/printsupport/cups/qcupsprintengine.cpp
index 2c05a76084..90de1a2a8b 100644
--- a/src/plugins/printsupport/cups/qcupsprintengine.cpp
+++ b/src/plugins/printsupport/cups/qcupsprintengine.cpp
@@ -96,6 +96,18 @@ void QCupsPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &v
case PPK_CupsOptions:
d->cupsOptions = value.toStringList();
+ case PPK_QPageSize:
+ d->setPageSize(value.value<QPageSize>());
+ break;
+ case PPK_QPageLayout: {
+ QPageLayout pageLayout = value.value<QPageLayout>();
+ if (pageLayout.isValid() && d->m_printDevice.isValidPageLayout(pageLayout, d->resolution)) {
+ d->m_pageLayout = pageLayout;
+ // Replace the page size with the CUPS page size
+ d->setPageSize(d->m_printDevice.supportedPageSize(pageLayout.pageSize()));
+ }
+ break;
+ }
QPdfPrintEngine::setProperty(key, value);