summaryrefslogtreecommitdiffstats
path: root/src/printsupport
diff options
context:
space:
mode:
authorZhang Hao <zhanghao@uniontech.com>2022-01-13 16:30:12 +0800
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-02-18 06:22:15 +0000
commitd600a68e65cb65ca831a850965255b39f983a55b (patch)
tree74097f3b5b7b6e1bbc961aca3dcc2d4d014c231d /src/printsupport
parentfa5063feeffe32806eafb33f4238f0cbe82b93b6 (diff)
Fix UI mismatch when QPrinter::setDuplex
Amends fa854f214a3c812e5548ff55d179dd07ef99053b. If user call QPrinter::setDuplex method, the QPrintDialog explicitDuplexMode value won't update. Fix this by: 1) handle device-specific default and value set in QPrinter in QCupsPrintEngine(Private) 2) handle the explicitly user-selected value in QPrintDialog(Private) Done-with: Michael Weghorn <m.weghorn@posteo.de> Fixes: QTBUG-99504 Change-Id: I1a471a8554e83aa4bec8bb95fcc95f9135b0ac8c Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 72931f492092a67c39cd7fb124d54e8752ee4933) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/printsupport')
-rw-r--r--src/printsupport/dialogs/qprintdialog_unix.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
index 7de8ec05f3..dbebd03719 100644
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
@@ -708,13 +708,14 @@ void QPrintDialogPrivate::selectPrinter(const QPrinter::OutputFormat outputForma
else
options.grayscale->setChecked(true);
- // keep duplex value explicitly set by user, if any, and selected printer supports it;
- // use device default otherwise
+ // duplex priorities to be as follows:
+ // 1) a user-selected duplex value in the dialog has highest prority
+ // 2) duplex value set in the QPrinter
QPrint::DuplexMode duplex;
if (explicitDuplexMode != QPrint::DuplexAuto && supportedDuplexMode.contains(explicitDuplexMode))
duplex = explicitDuplexMode;
else
- duplex = top->d->m_currentPrintDevice.defaultDuplexMode();
+ duplex = static_cast<QPrint::DuplexMode>(p->duplex());
switch (duplex) {
case QPrint::DuplexNone:
options.noDuplex->setChecked(true); break;