path: root/src/plugins/printsupport
diff options
authorAndy Shaw <>2017-11-28 15:41:30 +0100
committerAndy Shaw <>2018-05-02 13:32:09 +0000
commit3e001feb4d03d350ecea76f136c503675a2431ab (patch)
treed9d45d1623cf28c232ded118b4add60e40a10490 /src/plugins/printsupport
parent3e4b7223f102c40372bd11c50ecc684597f4bf32 (diff)
If the page size is not valid on the new printer, set a custom size
When the page size was not valid on the new printer, it would end up having the wrong page size name on the new printer. What should happen in this case is that it should set the originally set page size as a custom page size on the printer instead. Task-number: QTBUG-62221 Change-Id: Iaca34ae262f5d0685ca60e4ca4b38229a2283289 Reviewed-by: Albert Astals Cid <>
Diffstat (limited to 'src/plugins/printsupport')
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/printsupport/cups/qcupsprintengine.cpp b/src/plugins/printsupport/cups/qcupsprintengine.cpp
index bd0d641e79..6c29a99705 100644
--- a/src/plugins/printsupport/cups/qcupsprintengine.cpp
+++ b/src/plugins/printsupport/cups/qcupsprintengine.cpp
@@ -276,7 +276,10 @@ void QCupsPrintEnginePrivate::changePrinter(const QString &newPrinter)
grayscale = m_printDevice.defaultColorMode() == QPrint::GrayScale;
// Get the equivalent page size for this printer as supported names may be different
- setPageSize(m_pageLayout.pageSize());
+ if (m_printDevice.supportedPageSize(m_pageLayout.pageSize()).isValid())
+ setPageSize(m_pageLayout.pageSize());
+ else
+ setPageSize(QPageSize(m_pageLayout.pageSize().size(QPageSize::Point), QPageSize::Point));
void QCupsPrintEnginePrivate::setPageSize(const QPageSize &pageSize)