Move duplex member from QPdfPrintEnginePrivate to QCupsPrintEnginePrivate

Duplex doesn't really make sense in the context of printing to pdf,
and the variable was only being used in QCupsPrintEnginePrivate anyway

Change-Id: I801634c56759572825b5c9549d7a1dc92e5697a0
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
Albert Astals Cid 2018-02-06 11:22:13 +01:00
parent d145d291cd
commit d945e11837
5 changed files with 12 additions and 11 deletions

View File

@ -132,6 +132,9 @@ QVariant QCupsPrintEngine::property(PrintEnginePropertyKey key) const
case PPK_CupsOptions:
ret = d->cupsOptions;
break;
case PPK_Duplex:
ret = d->duplex;
break;
default:
ret = QPdfPrintEngine::property(key);
break;
@ -140,7 +143,9 @@ QVariant QCupsPrintEngine::property(PrintEnginePropertyKey key) const
}
QCupsPrintEnginePrivate::QCupsPrintEnginePrivate(QPrinter::PrinterMode m) : QPdfPrintEnginePrivate(m)
QCupsPrintEnginePrivate::QCupsPrintEnginePrivate(QPrinter::PrinterMode m)
: QPdfPrintEnginePrivate(m)
, duplex(QPrint::DuplexNone)
{
}

View File

@ -99,6 +99,7 @@ private:
QPrintDevice m_printDevice;
QStringList cupsOptions;
QString cupsTempFile;
QPrint::DuplexMode duplex;
};
QT_END_NAMESPACE

View File

@ -132,6 +132,8 @@ void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
// The following keys are settings that are unsupported by the PDF PrintEngine
case PPK_CustomBase:
break;
case PPK_Duplex:
break;
// The following keys are properties and settings that are supported by the PDF PrintEngine
case PPK_CollateCopies:
@ -203,9 +205,6 @@ void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
case PPK_FontEmbedding:
d->embedFonts = value.toBool();
break;
case PPK_Duplex:
d->duplex = static_cast<QPrint::DuplexMode>(value.toInt());
break;
case PPK_CustomPaperSize:
d->m_pageLayout.setPageSize(QPageSize(value.toSizeF(), QPageSize::Point));
break;
@ -249,6 +248,7 @@ QVariant QPdfPrintEngine::property(PrintEnginePropertyKey key) const
// The following keys are settings that are unsupported by the PDF PrintEngine
// Return sensible default values to ensure consistent behavior across platforms
case PPK_CustomBase:
case PPK_Duplex:
// Special case, leave null
break;
@ -322,9 +322,6 @@ QVariant QPdfPrintEngine::property(PrintEnginePropertyKey key) const
case PPK_FontEmbedding:
ret = d->embedFonts;
break;
case PPK_Duplex:
ret = d->duplex;
break;
case PPK_CustomPaperSize:
ret = d->m_pageLayout.fullRectPoints().size();
break;
@ -389,7 +386,6 @@ void QPdfPrintEnginePrivate::closePrintDevice()
QPdfPrintEnginePrivate::QPdfPrintEnginePrivate(QPrinter::PrinterMode m)
: QPdfEnginePrivate(),
duplex(QPrint::DuplexNone),
collate(true),
copies(1),
pageOrder(QPrinter::FirstPageFirst),

View File

@ -130,7 +130,6 @@ private:
QString printProgram;
QString selectionOption;
QPrint::DuplexMode duplex;
bool collate;
int copies;
QPrinter::PageOrder pageOrder;

View File

@ -1021,7 +1021,7 @@ void tst_QPrinter::duplex()
pdf.setOutputFormat(QPrinter::PdfFormat);
QCOMPARE(pdf.duplex(), QPrinter::DuplexNone);
pdf.setDuplex(QPrinter::DuplexAuto);
QCOMPARE(pdf.duplex(), QPrinter::DuplexAuto);
QCOMPARE(pdf.duplex(), QPrinter::DuplexNone); // pdf doesn't have the concept of duplex
QPrinter native;
if (native.outputFormat() == QPrinter::NativeFormat) {
@ -1066,7 +1066,7 @@ void tst_QPrinter::doubleSidedPrinting()
pdf.setOutputFormat(QPrinter::PdfFormat);
QCOMPARE(pdf.doubleSidedPrinting(), false);
pdf.setDoubleSidedPrinting(true);
QCOMPARE(pdf.doubleSidedPrinting(), true);
QCOMPARE(pdf.doubleSidedPrinting(), false); // pdf doesn't have the concept of duplex
QPrinter native;
if (native.outputFormat() == QPrinter::NativeFormat) {