Fix unix QPrintDialog initially selected printer

Unix QPrintDialog always set default printer as selected printer even
though something was explicitly requested.

[ChangeLog][QtPrintSupport][QPrintDialog] Properly pre-select explicitly
requested printer on Unix.

Task-number: QTBUG-63933
Change-Id: I6289f759d480b4891f4ddd7ff5aad3ae9ab4bc75
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Joni Poikelin 2017-10-20 15:55:34 +03:00
parent 60dfd59a60
commit b764c4d0aa

View File

@ -675,7 +675,9 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p, QPrinter *
widget.printers->addItems(printers);
const int idx = printers.indexOf(defaultPrinter);
const QString selectedPrinter = prn && !prn->printerName().isEmpty() ? prn->printerName() : defaultPrinter;
const int idx = printers.indexOf(selectedPrinter);
if (idx >= 0)
currentPrinterIndex = idx;
}