diff options
author | Jarkko Koivikko <[email protected]> | 2024-03-12 15:56:10 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <[email protected]> | 2024-04-13 17:10:08 +0000 |
commit | 8bee75a19afef0965acddf8c98889927c0318ec9 (patch) | |
tree | 55c6355a2f55251f7b95870a2930d1f88875f4a6 | |
parent | a6343743425b1c070214039056a8c61cd869fea7 (diff) |
print: windows: Fix setting page orientation
Previously when PPK_Orientation property was set, updateMetrics() was
called before doReinit() and updateMetrics() used physical dimensions
of the DC initialized with previous orientation, which resulted in
miscalculation of m_paintRectPixels, origin_x and origin_y variables.
This bug manifested itself as all sorts of weird behavior, such as
unexpected margins when changing paper size and printing beyond paper
margins.
Change-Id: I2d0e104bee11165e3541e7f3119b29edd4b882c8
Reviewed-by: Oliver Wolff <[email protected]>
(cherry picked from commit 223b92490edfd4e3e75e634831258c54d5b0a501)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
(cherry picked from commit ff5bda7e115c304d44ae1c12b1268cfc0894ce55)
-rw-r--r-- | src/printsupport/platform/windows/qprintengine_win.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/printsupport/platform/windows/qprintengine_win.cpp b/src/printsupport/platform/windows/qprintengine_win.cpp index dff62b9789f..17dad057144 100644 --- a/src/printsupport/platform/windows/qprintengine_win.cpp +++ b/src/printsupport/platform/windows/qprintengine_win.cpp @@ -1131,8 +1131,8 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & QPageLayout::Orientation orientation = QPageLayout::Orientation(value.toInt()); d->devMode->dmOrientation = orientation == QPageLayout::Landscape ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT; d->m_pageLayout.setOrientation(orientation); - d->updateMetrics(); d->doReinit(); + d->updateMetrics(); #ifdef QT_DEBUG_METRICS qDebug() << "QWin32PrintEngine::setProperty(PPK_Orientation," << orientation << ')'; d->debugMetrics(); |