From c1aaa13939f3f2fdc46bccf718dbd406c243f741 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 20 Dec 2017 10:41:33 +0100 Subject: Fix custom page size handling in the Unix print dialog There were several problems that i've fixed in a single commit since they are very interwinded * The dialog used QPageSize::Custom for two things, the custom sizes coming from the printer and the "user can write whatever size they want" size. Now only the printer custom sizes use QPageSize::Custom and we use m_realCustomPageSizeIndex for the "user can write whatever size they want" one. * The dialog stored the QPageSize id as the combo userData, that doesn't work when the printer has multiple custom sizes since they all share QPageSize::Custom so now it stores the QPageSize itself Task-number: QTBUG-58733 Change-Id: Ie640a07bb5e24b753db83c091c836e8af4ff126c Reviewed-by: Andy Shaw --- src/plugins/printsupport/cups/qcupsprintengine.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/printsupport/cups/qcupsprintengine.cpp b/src/plugins/printsupport/cups/qcupsprintengine.cpp index 287ab4b27a..763f676e41 100644 --- a/src/plugins/printsupport/cups/qcupsprintengine.cpp +++ b/src/plugins/printsupport/cups/qcupsprintengine.cpp @@ -104,10 +104,9 @@ void QCupsPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &v break; case PPK_QPageLayout: { QPageLayout pageLayout = value.value(); - if (pageLayout.isValid() && d->m_printDevice.isValidPageLayout(pageLayout, d->resolution)) { + if (pageLayout.isValid() && (d->m_printDevice.isValidPageLayout(pageLayout, d->resolution) || d->m_printDevice.supportsCustomPageSizes())) { d->m_pageLayout = pageLayout; - // Replace the page size with the CUPS page size - d->setPageSize(d->m_printDevice.supportedPageSize(pageLayout.pageSize())); + d->setPageSize(pageLayout.pageSize()); } break; } -- cgit v1.2.3