diff options
author | Albert Astals Cid <albert.astals.cid@kdab.com> | 2017-12-20 10:41:33 +0100 |
---|---|---|
committer | Albert Astals Cid <albert.astals.cid@kdab.com> | 2018-01-09 15:42:33 +0000 |
commit | c1aaa13939f3f2fdc46bccf718dbd406c243f741 (patch) | |
tree | a581697a615810418567db345e761fdd09159189 /src/plugins/printsupport/cups/qcupsprintengine.cpp | |
parent | bc632bc2bfe1a966bb187c20bb321d31fb8fe0b7 (diff) |
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 <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins/printsupport/cups/qcupsprintengine.cpp')
-rw-r--r-- | src/plugins/printsupport/cups/qcupsprintengine.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
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<QPageLayout>(); - 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; } |