summaryrefslogtreecommitdiffstats
path: root/src/printsupport
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2017-01-10 06:33:55 +0100
committerAndy Shaw <andy.shaw@qt.io>2017-01-19 14:09:15 +0000
commitd2a589e1f0c9c7770bc1161296f7041046c3c369 (patch)
tree7601520e832dfec2253fee48770ca6ffe7abe8d2 /src/printsupport
parent11875b89f4806264ab16d511c132f2f11ac36e6b (diff)
When changing the printer used, try to preserve the original page settings
Since not all elements of the original page settings can be kept, it needs to be set bit by bit in order to apply what it can. Change-Id: I82a2de91e3b8e344a61a290bb4486885fde62b4e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/printsupport')
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index 706a7c4b02..5a48e92a3a 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -1224,11 +1224,20 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get();
if (!ps)
return;
+
+ QVariant pageSize = QVariant::fromValue(d->m_pageLayout.pageSize());
+ const bool isFullPage = (d->m_pageLayout.mode() == QPageLayout::FullPageMode);
+ QVariant orientation = QVariant::fromValue(d->m_pageLayout.orientation());
+ QVariant margins = QVariant::fromValue(
+ QPair<QMarginsF, QPageLayout::Unit>(d->m_pageLayout.margins(), d->m_pageLayout.units()));
QPrintDevice printDevice = ps->createPrintDevice(id.isEmpty() ? ps->defaultPrintDeviceId() : id);
if (printDevice.isValid()) {
d->m_printDevice = printDevice;
- // TODO Do we need to check if the page size is valid on new printer?
d->initialize();
+ setProperty(PPK_QPageSize, pageSize);
+ setProperty(PPK_FullPage, QVariant(isFullPage));
+ setProperty(PPK_Orientation, orientation);
+ setProperty(PPK_QPageMargins, margins);
}
break;
}