summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qpalette.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-07-08 16:06:19 +0200
committerFriedemann Kleint <Friedemann.Kleint@digia.com>2014-07-08 16:13:43 +0200
commit25d0d2e099082b12857384dcebcab494f690b581 (patch)
tree5420c1cda7b5d9ef8526b9d22938252848b96854 /src/gui/kernel/qpalette.cpp
parent813af5f0655c332b2853d156b91c5265b85cbc70 (diff)
Improve debug output of QPalette.
Task-number: QTBUG-39997 Change-Id: I25b8ce8791c25c7ef7b97270ec50dad45fbdfecd Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/gui/kernel/qpalette.cpp')
-rw-r--r--src/gui/kernel/qpalette.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index f284c20af5..62e555b821 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -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.
@@ -1141,9 +1141,33 @@ Q_GUI_EXPORT QPalette qt_fusionPalette()
}
#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug dbg, const QPalette &)
+QDebug operator<<(QDebug dbg, const QPalette &p)
{
- dbg.nospace() << "QPalette()";
+ const char *colorGroupNames[] = {"Active", "Disabled", "Inactive"};
+ const char *colorRoleNames[] =
+ {"WindowText", "Button", "Light", "Midlight", "Dark", "Mid", "Text",
+ "BrightText", "ButtonText", "Base", "Window", "Shadow", "Highlight",
+ "HighlightedText", "Link", "LinkVisited", "AlternateBase", "NoRole",
+ "ToolTipBase","ToolTipText" };
+ QDebug nospace = dbg.nospace();
+ const uint mask = p.resolve();
+ nospace << "QPalette(resolve=" << hex << showbase << mask << ',';
+ for (int role = 0; role < (int)QPalette::NColorRoles; ++role) {
+ if (mask & (1<<role)) {
+ if (role)
+ nospace << ',';
+ nospace << colorRoleNames[role] << ":[";
+ for (int group = 0; group < (int)QPalette::NColorGroups; ++group) {
+ if (group)
+ nospace << ',';
+ const QRgb color = p.color(static_cast<QPalette::ColorGroup>(group),
+ static_cast<QPalette::ColorRole>(role)).rgba();
+ nospace << colorGroupNames[group] << ':' << color;
+ }
+ nospace << ']';
+ }
+ }
+ nospace << ')' << noshowbase << dec;
return dbg.space();
}
#endif