QPrinter - Fix Printer Selection option on Windows
Make the printer selection option api public on Windows to be consistent with Mac, and with the print program api which is already public. Change-Id: I3da9684288348eaa43276ca8534a1d5809f7027b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
27c33a8f7a
commit
5af95d077b
@ -1828,11 +1828,17 @@ QList<QPrinter::PaperSource> QPrinter::supportedPaperSources() const
|
||||
|
||||
Any other value implies that the given value should be used.
|
||||
|
||||
\warning This function is not available on Windows.
|
||||
This function always returns an empty string on Windows and Mac.
|
||||
|
||||
\sa setPrinterSelectionOption()
|
||||
\sa setPrinterSelectionOption(), setPrintProgram()
|
||||
*/
|
||||
|
||||
QString QPrinter::printerSelectionOption() const
|
||||
{
|
||||
Q_D(const QPrinter);
|
||||
return d->printEngine->property(QPrintEngine::PPK_SelectionOption).toString();
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void QPrinter::setPrinterSelectionOption(const QString &option)
|
||||
|
||||
@ -1844,24 +1850,16 @@ QList<QPrinter::PaperSource> QPrinter::supportedPaperSources() const
|
||||
If the printer selection option is changed while the printer is
|
||||
active, the current print job may or may not be affected.
|
||||
|
||||
\warning This function is not available on Windows.
|
||||
This function has no effect on Windows or Mac.
|
||||
|
||||
\sa printerSelectionOption()
|
||||
\sa printerSelectionOption(), setPrintProgram()
|
||||
*/
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
QString QPrinter::printerSelectionOption() const
|
||||
{
|
||||
Q_D(const QPrinter);
|
||||
return d->printEngine->property(QPrintEngine::PPK_SelectionOption).toString();
|
||||
}
|
||||
|
||||
void QPrinter::setPrinterSelectionOption(const QString &option)
|
||||
{
|
||||
Q_D(QPrinter);
|
||||
d->setProperty(QPrintEngine::PPK_SelectionOption, option);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 4.1
|
||||
|
@ -227,10 +227,8 @@ public:
|
||||
QRectF paperRect(Unit) const;
|
||||
QRectF pageRect(Unit) const;
|
||||
|
||||
#if !defined(Q_OS_WIN) || defined(Q_QDOC)
|
||||
QString printerSelectionOption() const;
|
||||
void setPrinterSelectionOption(const QString &);
|
||||
#endif
|
||||
|
||||
bool newPage();
|
||||
bool abort();
|
||||
|
@ -1643,10 +1643,9 @@ void tst_QPrinter::printerSelectionOption()
|
||||
// printerSelectionOption() / setPrinterSelectionOption() / PPK_SelectionOption
|
||||
// PdfFormat: Supported
|
||||
// NativeFormat, Cups: Supported
|
||||
// NativeFormat, Win: Unsupported, ifdef'd out TODO remove ifdef, always QString()
|
||||
// NativeFormat, Win: Unsupported, always QString()
|
||||
// NativeFormat, Mac: Unsupported, always QString()
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
QPrinter pdf;
|
||||
pdf.setOutputFormat(QPrinter::PdfFormat);
|
||||
QCOMPARE(pdf.printerSelectionOption(), QString());
|
||||
@ -1661,9 +1660,9 @@ void tst_QPrinter::printerSelectionOption()
|
||||
// Test set/get
|
||||
QString expected = QStringLiteral("Optional option");
|
||||
native.setPrinterSelectionOption(expected);
|
||||
#ifdef Q_OS_MAC
|
||||
#if defined Q_OS_MAC || defined Q_OS_WIN
|
||||
expected.clear();
|
||||
#endif // Q_OS_MAC
|
||||
#endif // Q_OS_MAC || Q_OS_WIN
|
||||
QCOMPARE(native.printerSelectionOption(), expected);
|
||||
|
||||
// Test value preservation
|
||||
@ -1674,7 +1673,6 @@ void tst_QPrinter::printerSelectionOption()
|
||||
} else {
|
||||
QSKIP("No printers installed, cannot test NativeFormat, please install printers to test");
|
||||
}
|
||||
#endif // Q_OS_WIN
|
||||
}
|
||||
|
||||
void tst_QPrinter::resolution()
|
||||
|
Loading…
Reference in New Issue
Block a user