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/widgets/kernel/qicon.cpp | 8 ++++++++ src/widgets/kernel/qicon.h | 4 ++++ src/widgets/kernel/qlayoutitem.cpp | 10 ++++++++++ src/widgets/kernel/qsizepolicy.h | 4 ++++ 4 files changed, 26 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qicon.cpp b/src/widgets/kernel/qicon.cpp index 1b1b490d2b..185542420e 100644 --- a/src/widgets/kernel/qicon.cpp +++ b/src/widgets/kernel/qicon.cpp @@ -1161,6 +1161,14 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon) #endif //QT_NO_DATASTREAM +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const QIcon &i) +{ + dbg.nospace() << "QIcon(" << i.name() << ')'; + return dbg.space(); +} +#endif + /*! \fn DataPtr &QIcon::data_ptr() \internal diff --git a/src/widgets/kernel/qicon.h b/src/widgets/kernel/qicon.h index 76c7fda7e2..a72ae236f1 100644 --- a/src/widgets/kernel/qicon.h +++ b/src/widgets/kernel/qicon.h @@ -136,6 +136,10 @@ Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QIcon &); Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QIcon &); #endif +#ifndef QT_NO_DEBUG_STREAM +Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QIcon &); +#endif + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp index 8479ae92c5..732c941c74 100644 --- a/src/widgets/kernel/qlayoutitem.cpp +++ b/src/widgets/kernel/qlayoutitem.cpp @@ -42,6 +42,7 @@ #include "qlayout.h" #include "qapplication.h" +#include "qdebug.h" #include "qlayoutengine_p.h" #include "qmenubar.h" #include "qtoolbar.h" @@ -836,4 +837,13 @@ int QWidgetItemV2::heightForWidth(int width) const return height; } +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const QSizePolicy &p) +{ + dbg.nospace() << "QSizePolicy(horizontalPolicy = " << p.horizontalPolicy() + << ", verticalPolicy = " << p.verticalPolicy() << ')'; + return dbg.space(); +} +#endif + QT_END_NAMESPACE diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h index 32ef8535f1..8932eb8ed8 100644 --- a/src/widgets/kernel/qsizepolicy.h +++ b/src/widgets/kernel/qsizepolicy.h @@ -181,6 +181,10 @@ Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &); Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &); #endif +#ifndef QT_NO_DEBUG_STREAM +Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QSizePolicy &); +#endif + inline void QSizePolicy::transpose() { Policy hData = horizontalPolicy(); Policy vData = verticalPolicy(); -- cgit v1.2.3