summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgunnar <gunnar@trolltech.com>2009-11-04 18:38:01 (GMT)
committergunnar <gunnar@trolltech.com>2009-11-04 20:13:00 (GMT)
commit391441b2ce2be527db0829798631436670df0965 (patch)
treec9fc2bed6e053c4da8017d13991892b8c5aa66e3
parent56b8d24c337d30c6bcdda101fbc664c4fd6d642d (diff)
downloadQt-391441b2ce2be527db0829798631436670df0965.zip
Qt-391441b2ce2be527db0829798631436670df0965.tar.gz
Qt-391441b2ce2be527db0829798631436670df0965.tar.bz2
Added some helpful info to QBrush and QPen's QDebug operators
Reviewed-by: TrustMe
-rw-r--r--src/gui/painting/qbrush.cpp24
-rw-r--r--src/gui/painting/qpen.cpp12
2 files changed, 34 insertions, 2 deletions
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index cbfbba6..6f5d892 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -970,7 +970,29 @@ bool QBrush::operator==(const QBrush &b) const
QDebug operator<<(QDebug dbg, const QBrush &b)
{
#ifndef Q_BROKEN_DEBUG_STREAM
- dbg.nospace() << "QBrush(" << b.color() << ',' << b.style() << ')';
+ char *BRUSH_STYLES[] = {
+ "NoBrush",
+ "SolidPattern",
+ "Dense1Pattern",
+ "Dense2Pattern",
+ "Dense3Pattern",
+ "Dense4Pattern",
+ "Dense5Pattern",
+ "Dense6Pattern",
+ "Dense7Pattern",
+ "HorPattern",
+ "VerPattern",
+ "CrossPattern",
+ "BDiagPattern",
+ "FDiagPattern",
+ "DiagCrossPattern",
+ "LinearGradientPattern",
+ "RadialGradientPattern",
+ "ConicalGradientPattern",
+ "TexturePattern"
+ };
+
+ dbg.nospace() << "QBrush(" << b.color() << ',' << BRUSH_STYLES[b.style()] << ')';
return dbg.space();
#else
qWarning("This compiler doesn't support streaming QBrush to QDebug");
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index 41efc80..9746747 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -983,8 +983,18 @@ QDataStream &operator>>(QDataStream &s, QPen &p)
QDebug operator<<(QDebug dbg, const QPen &p)
{
#ifndef Q_BROKEN_DEBUG_STREAM
+ char *PEN_STYLES[] = {
+ "NoPen",
+ "SolidLine",
+ "DashLine",
+ "DotLine",
+ "DashDotLine",
+ "DashDotDotLine",
+ "CustomDashLine"
+ };
+
dbg.nospace() << "QPen(" << p.width() << ',' << p.brush()
- << ',' << int(p.style()) << ',' << int(p.capStyle())
+ << ',' << PEN_STYLES[p.style()] << ',' << int(p.capStyle())
<< ',' << int(p.joinStyle()) << ',' << p.dashPattern()
<< ',' << p.dashOffset()
<< ',' << p.miterLimit() << ')';