From 43e8c1896d5c9c04a78983d10afeb1d5a2112995 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 21 Jul 2014 16:20:13 +0200 Subject: Improve debug output of QImage, QPixmap and QIcon. Task-number: QTBUG-38858 Change-Id: Ie45d595478f971c7ed973d911c65484d947d2a60 Reviewed-by: Alessandro Portale --- src/gui/image/qicon.cpp | 12 +++++++++++- src/gui/image/qimage.cpp | 13 ++++++++++++- src/gui/image/qpixmap.cpp | 11 ++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) (limited to 'src/gui/image') diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 681e7e3f79..4f5e9c3d1f 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1321,7 +1321,17 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon) #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QIcon &i) { - dbg.nospace() << "QIcon(" << i.name() << ')'; + QDebug nospace = dbg.nospace(); + nospace << "QIcon("; + if (i.isNull()) { + nospace << "null"; + } else { + if (!i.name().isEmpty()) + nospace << i.name() << ','; + nospace << "availableSizes[normal,Off]=" << i.availableSizes() + << ",cacheKey=" << showbase << hex << i.cacheKey() << dec << noshowbase; + } + nospace << ')'; return dbg.space(); } #endif diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index c48924e2fd..40f8b9e4d8 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4550,7 +4550,18 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QImage &i) { - dbg.nospace() << "QImage(" << i.size() << ')'; + QDebug nospace = dbg.nospace(); + nospace << "QImage("; + if (i.isNull()) { + nospace << "null"; + } else { + nospace << i.size() << ",format=" << i.format() << ",depth=" << i.depth(); + if (i.colorCount()) + nospace << ",colorCount=" << i.colorCount(); + nospace << ",devicePixelRatio=" << i.devicePixelRatio() + << ",bytesPerLine=" << i.bytesPerLine() << ",byteCount=" << i.byteCount(); + } + nospace << ')'; return dbg.space(); } #endif diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index f4222d2360..0ed840e0c0 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1724,7 +1724,16 @@ QPlatformPixmap* QPixmap::handle() const #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QPixmap &r) { - dbg.nospace() << "QPixmap(" << r.size() << ')'; + QDebug nospace = dbg.nospace(); + nospace << "QPixmap("; + if (r.isNull()) { + nospace << "null"; + } else { + nospace << r.size() << ",depth=" << r.depth() + << ",devicePixelRatio=" << r.devicePixelRatio() + << ",cacheKey=" << showbase << hex << r.cacheKey() << dec << noshowbase; + } + nospace << ')'; return dbg.space(); } #endif -- cgit v1.2.3