From 25d0d2e099082b12857384dcebcab494f690b581 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 8 Jul 2014 16:06:19 +0200 Subject: Improve debug output of QPalette. Task-number: QTBUG-39997 Change-Id: I25b8ce8791c25c7ef7b97270ec50dad45fbdfecd Reviewed-by: Shawn Rutledge --- src/gui/kernel/qpalette.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src/gui/kernel/qpalette.cpp') 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<(group), + static_cast(role)).rgba(); + nospace << colorGroupNames[group] << ':' << color; + } + nospace << ']'; + } + } + nospace << ')' << noshowbase << dec; return dbg.space(); } #endif -- cgit v1.2.3