QtPrintSupport: Change QPrinterInfo::defaultPrinter() behaviour
authorJohn Layt <jlayt@kde.org>
Fri, 25 May 2012 18:28:37 +0000 (19:28 +0100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 28 May 2012 22:41:46 +0000 (00:41 +0200)
commit5bd5f6ae69d749bc3adef58edc906b9fb46bb7a8
tree48ae8bc756cba7cba683de6de12f01d3eaffc58d
parentd9a7f9488f7b8a3f7d5963bce88f375282979f25
QtPrintSupport: Change QPrinterInfo::defaultPrinter() behaviour

In Qt4 QPrinterInfo::defaultPrinter() has inconsistant behaviour
depending on the platform.  On Mac and Unix if no default printer
is set in the system then the first available printer is returned.
but on Windows it returns a null QPrinterInfo.

Currently Qt5 returns the first printer on all platforms, but this
causes an inconsistency if you call isDefault() on the returned
QPrinterInfo.

The apidox is slightly ambiguous, but does seem to imply no printer
will be returned if no default is set.

The only place in Qt the public api is used is in QPrinter which is
coded expecting that defaultPrinter() may return null but for there
still to be availablePrinters().

Change-Id: I1bbef8cba259b7d51980a0199e9fd6d5466d921f
Reviewed-by: Teemu Katajisto <teemu.katajisto@digia.com>
Reviewed-by: John Layt <jlayt@kde.org>
src/printsupport/kernel/qplatformprintersupport_qpa.cpp
src/printsupport/kernel/qprinterinfo.cpp