QUnixPrintWidgetPrivate::_q_printerChanged: Update state correctly

We need to update the printer output format and the current print device
when changing the printer so that if the user opens the properties dialog
for that printer it reflects correctly the selected printer.

Change-Id: Ib6767a74b74b8eebe43ff17006b6105c483a08b6
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
bb10
Albert Astals Cid 2018-01-09 12:19:44 +01:00
parent f6fd3f18d3
commit bc632bc2bf
1 changed files with 6 additions and 0 deletions

View File

@ -915,14 +915,20 @@ void QUnixPrintWidgetPrivate::_q_printerChanged(int index)
widget.lOutput->setEnabled(true);
if (optionsPane)
optionsPane->selectPrinter(QPrinter::PdfFormat);
printer->setOutputFormat(QPrinter::PdfFormat);
m_currentPrintDevice = QPrintDevice();
return;
}
}
if (printer) {
printer->setOutputFormat(QPrinter::NativeFormat);
QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get();
if (ps)
m_currentPrintDevice = ps->createPrintDevice(widget.printers->itemText(index));
else
m_currentPrintDevice = QPrintDevice();
printer->setPrinterName(m_currentPrintDevice.id());