diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-04-21 15:00:13 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-04-23 09:59:30 +0000 |
commit | 319f3c89b15aa3978877df976aa2bd740082ff50 (patch) | |
tree | cd28d462c3fb656eb8655afb51574e8aa51a3c44 /src/printsupport/kernel/qprinterinfo.cpp | |
parent | e8dc128d1d327bbd6168e4321a67c2b074ffa726 (diff) |
Add debug operator for QPrinterInfo.
Add formatting helper to private class QPrintDevice and
use that to implement debug operators for QPrintDevice and QPrinterInfo.
Sample output:
(QPrinterInfo(id="HP_Color_LaserJet_CM6030_MFP", state=0, name="HP Color LaserJet CM6030 MFP", makeAndModel="HP Color LaserJet CM6030 MFP Postscript (recommended)", default, defaultPageSize=QPageSize("Letter", "Letter", 612x792pt, 2), supportsCustomPageSizes, physicalPageSize=(278, 396)..(907, 1296), defaultResolution=600, defaultDuplexMode=0, defaultColorMode=1, supportedMimeTypes=( "application/pdf" "application/postscript" "image/gif" "image/png" "image/jpeg" "image/tiff" "text/html" "text/plain")))
Task-number: QTBUG-44991
Change-Id: I187414d2f68871e38ace0bd66661d2e37712f662
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Diffstat (limited to 'src/printsupport/kernel/qprinterinfo.cpp')
-rw-r--r-- | src/printsupport/kernel/qprinterinfo.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/printsupport/kernel/qprinterinfo.cpp b/src/printsupport/kernel/qprinterinfo.cpp index 33d67e3a55..ad488a10ed 100644 --- a/src/printsupport/kernel/qprinterinfo.cpp +++ b/src/printsupport/kernel/qprinterinfo.cpp @@ -31,6 +31,8 @@ #ifndef QT_NO_PRINTER +#include <QtCore/qdebug.h> + #include <qpa/qplatformprintplugin.h> #include <qpa/qplatformprintersupport.h> @@ -469,6 +471,21 @@ QPrinterInfo QPrinterInfo::printerInfo(const QString &printerName) return QPrinterInfo(printerName); } +# ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug debug, const QPrinterInfo &p) +{ + QDebugStateSaver saver(debug); + debug.nospace(); + debug << "QPrinterInfo("; + if (p.isNull()) + debug << "null"; + else + p.d_ptr->m_printDevice.format(debug); + debug << ')'; + return debug; +} +# endif // !QT_NO_DEBUG_STREAM + QT_END_NAMESPACE #endif // QT_NO_PRINTER |