From 18617f2824af67a690ade336f5d27f09752c7206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 4 Jan 2012 14:14:08 +0100 Subject: Implement QDebug stream operators for builtin classes QDebug stream operator was added for: QPixmap, QImage, QUuid, QBitArray, QLocale, QRegExp, QCursor, QPalette, QTextFormat, QTextLength, QIcon and QSizePolicy Change-Id: Ibcf5c9b599ba322d53cb106d8e5e157427ebe757 Reviewed-by: Thiago Macieira Reviewed-by: Bradley T. Hughes Reviewed-by: Denis Dzyubenko --- src/corelib/tools/qbitarray.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/corelib/tools/qbitarray.cpp') diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index 4ef066cf8b6..96811cc179b 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -725,6 +725,24 @@ QDataStream &operator>>(QDataStream &in, QBitArray &ba) } #endif // QT_NO_DATASTREAM +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const QBitArray &array) +{ + dbg.nospace() << "QBitArray("; + for (int i = 0; i < array.size();) { + if (array.testBit(i)) + dbg.nospace() << '1'; + else + dbg.nospace() << '0'; + i += 1; + if (!(i % 4) && (i < array.size())) + dbg.nospace() << ' '; + } + dbg.nospace() << ')'; + return dbg.space(); +} +#endif + /*! \fn DataPtr &QBitArray::data_ptr() \internal -- cgit v1.2.3