path: root/src/plugins/printsupport
diff options
authorMiikka Heikkinen <>2012-03-21 17:17:42 +0200
committerQt by Nokia <>2012-03-23 00:41:34 +0100
commitb188221fee0eaacec115b514185a0508ef655897 (patch)
tree167b09e47cc3b63dadf64527339a4248eda770b3 /src/plugins/printsupport
parent82c974f753e0081f8bedc356ea07a8cfa6fae583 (diff)
Fix QPrinter test in Windows
Fixed Q_WS_WIN flagging to Q_OS_WIN in QPrinter API and related implementation to make API match the documentation and Qt 4.8. Also Removed the unused internal HDC related functions from the API, that were previously behind Q_WS_WIN flag. Some of the properties tested are documented to be valid for native print engine only in X11 environment, so skipped testing those in non-xcb environments. Copy collation is also apparently not supported in Windows native print engine, though this seems to be undocumented, so skipped that only in Windows. At least one of the test blocks in tst_QPrinter::valuePreservation() failed due to default printer not getting set properly, so fixed that, too. Task-number: QTBUG-24191 Task-number: QTBUG-22927 Change-Id: I44a5e3d647a1279fcc7f1e99de6881f9be330246 Reviewed-by: Friedemann Kleint <>
Diffstat (limited to 'src/plugins/printsupport')
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/printsupport/windows/qwindowsprintersupport.cpp b/src/plugins/printsupport/windows/qwindowsprintersupport.cpp
index 2905063c51..c5c60ae5cc 100644
--- a/src/plugins/printsupport/windows/qwindowsprintersupport.cpp
+++ b/src/plugins/printsupport/windows/qwindowsprintersupport.cpp
@@ -58,12 +58,13 @@ QWindowsPrinterSupport::QWindowsPrinterSupport()
LPBYTE buffer = new BYTE[needed];
if (EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, buffer, needed, &needed, &returned)) {
PPRINTER_INFO_4 infoList = reinterpret_cast<PPRINTER_INFO_4>(buffer);
- QPrinterInfo defPrn = defaultPrinter();
+ QString defaultPrinterName;
+ QWin32PrintEngine::queryDefaultPrinter(defaultPrinterName, QString(), QString());
for (uint i = 0; i < returned; ++i) {
QString printerName(QString::fromWCharArray(infoList[i].pPrinterName));
QPrinterInfo printerInfo(printerName);
- if (printerInfo.printerName() == defPrn.printerName())
+ if (printerInfo.printerName() == defaultPrinterName)
printerInfo.d_ptr->isDefault = true;