diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-04-20 10:22:49 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-04-29 10:26:45 +0000 |
commit | a21c3b7e26a28ed27a57793b58b662a7bf506930 (patch) | |
tree | cef8d462b6e0b1fcfa1caaf5d63aed53cf43ec09 /src/qtdiag | |
parent | c9b1b816a215e19535ad6a79faee3f3ffd87acba (diff) |
qtdiag: Output the application's palette.
Output active colors of the palette.
Change-Id: I055222468fe2e0fc0c447c4acbdb6ae7ac7d0bff
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qtdiag')
-rw-r--r-- | src/qtdiag/qtdiag.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/qtdiag/qtdiag.cpp b/src/qtdiag/qtdiag.cpp index 310cbea08..901df8f0b 100644 --- a/src/qtdiag/qtdiag.cpp +++ b/src/qtdiag/qtdiag.cpp @@ -38,6 +38,7 @@ #include <QtGui/QScreen> #include <QtGui/QFont> #include <QtGui/QFontDatabase> +#include <QtGui/QPalette> #ifndef QT_NO_OPENGL # include <QtGui/QOpenGLContext> # include <QtGui/QOpenGLFunctions> @@ -244,6 +245,17 @@ static QString formatValueQDebug(T t) return result; } +QTextStream &operator<<(QTextStream &str, const QPalette &palette) +{ + for (int r = 0; r < int(QPalette::NColorRoles); ++r) { + const QPalette::ColorRole role = static_cast< QPalette::ColorRole>(r); + const QColor color = palette.color(QPalette::Active, role); + if (color.isValid()) + str << " " << formatValueQDebug(role) << ": " << color.name(QColor::HexArgb) << '\n'; + } + return str; +} + static inline QByteArrayList qtFeatures() { QByteArrayList result; @@ -499,6 +511,8 @@ QString qtDiag(unsigned flags) str << " " << formatValueQDebug(writingSystems.at(i)) << '\n'; } + str << "\nPalette:\n" << QGuiApplication::palette(); + const QList<QScreen*> screens = QGuiApplication::screens(); const int screenCount = screens.size(); str << "\nScreens: " << screenCount << ", High DPI scaling: " |