summaryrefslogtreecommitdiffstats
path: root/src/printsupport/dialogs/qprintdialog_unix.cpp
diff options
context:
space:
mode:
authorZhang Hao <zhanghao@uniontech.com>2022-01-13 16:30:12 +0800
committerZhang Hao <zhanghao@uniontech.com>2022-02-18 12:19:17 +0800
commit72931f492092a67c39cd7fb124d54e8752ee4933 (patch)
tree27b25044069f807fa32193dd67854f82f0191225 /src/printsupport/dialogs/qprintdialog_unix.cpp
parent715ed74c89a7e6c64aa85e36682699d41c195a33 (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> Pick-to: 5.15 6.2 6.3 Fixes: QTBUG-99504 Change-Id: I1a471a8554e83aa4bec8bb95fcc95f9135b0ac8c Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/printsupport/dialogs/qprintdialog_unix.cpp')
-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;