Keep global state of debug stream (QImage, QPixmap, and QIcon)

Make sure that the stream's formatting settings are preserved.

Change-Id: Ib13b5e0b36b2ef801da2d2d5c240d28dc1b04653
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Kai Koehne 2014-07-22 08:41:17 +02:00
parent b5b4eb742c
commit 7aae6219d5
3 changed files with 30 additions and 24 deletions

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
@ -1321,18 +1321,20 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QIcon &i)
{
QDebug nospace = dbg.nospace();
nospace << "QIcon(";
QDebugStateSaver saver(dbg);
dbg.resetFormat();
dbg.nospace();
dbg << "QIcon(";
if (i.isNull()) {
nospace << "null";
dbg << "null";
} else {
if (!i.name().isEmpty())
nospace << i.name() << ',';
nospace << "availableSizes[normal,Off]=" << i.availableSizes()
dbg << i.name() << ',';
dbg << "availableSizes[normal,Off]=" << i.availableSizes()
<< ",cacheKey=" << showbase << hex << i.cacheKey() << dec << noshowbase;
}
nospace << ')';
return dbg.space();
dbg << ')';
return dbg;
}
#endif

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
@ -4550,19 +4550,21 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QImage &i)
{
QDebug nospace = dbg.nospace();
nospace << "QImage(";
QDebugStateSaver saver(dbg);
dbg.resetFormat();
dbg.nospace();
dbg << "QImage(";
if (i.isNull()) {
nospace << "null";
dbg << "null";
} else {
nospace << i.size() << ",format=" << i.format() << ",depth=" << i.depth();
dbg << i.size() << ",format=" << i.format() << ",depth=" << i.depth();
if (i.colorCount())
nospace << ",colorCount=" << i.colorCount();
nospace << ",devicePixelRatio=" << i.devicePixelRatio()
dbg << ",colorCount=" << i.colorCount();
dbg << ",devicePixelRatio=" << i.devicePixelRatio()
<< ",bytesPerLine=" << i.bytesPerLine() << ",byteCount=" << i.byteCount();
}
nospace << ')';
return dbg.space();
dbg << ')';
return dbg;
}
#endif

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
@ -1724,17 +1724,19 @@ QPlatformPixmap* QPixmap::handle() const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPixmap &r)
{
QDebug nospace = dbg.nospace();
nospace << "QPixmap(";
QDebugStateSaver saver(dbg);
dbg.resetFormat();
dbg.nospace();
dbg << "QPixmap(";
if (r.isNull()) {
nospace << "null";
dbg << "null";
} else {
nospace << r.size() << ",depth=" << r.depth()
dbg << r.size() << ",depth=" << r.depth()
<< ",devicePixelRatio=" << r.devicePixelRatio()
<< ",cacheKey=" << showbase << hex << r.cacheKey() << dec << noshowbase;
}
nospace << ')';
return dbg.space();
dbg << ')';
return dbg;
}
#endif