diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-04-03 14:11:17 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-03 14:49:25 +0200 |
commit | 95d411578d44693059c05ccbec586aab4363092a (patch) | |
tree | 8b58eb25dc97a823a7dcfcf38af60fc6028b7651 /src/plugins/platforms/windows | |
parent | f49a26623650d3bcc2f6759b3c32acee0ac3c051 (diff) |
WindowsXP: Fix Item view alternate color being black.
The theme palette needs to be initialized by the standard palette.
Change-Id: I91c2ac9aea122e6ed9c09c96b35dfe0ef18a3ca0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r-- | src/plugins/platforms/windows/qwindowstheme.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index f3a9d91d00..513bebbc8b 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -68,12 +68,27 @@ static inline QTextStream& operator<<(QTextStream &str, const QColor &c) return str; } +static inline void paletteRoleToString(const QPalette &palette, + const QPalette::ColorRole role, + QTextStream &str) +{ + str << "Role: "; + str.setFieldWidth(2); + str.setPadChar(QLatin1Char('0')); + str << role; + str.setFieldWidth(0); + str << " Active: " << palette.color(QPalette::Active, role) + << " Disabled: " << palette.color(QPalette::Disabled, role) + << " Inactive: " << palette.color(QPalette::Inactive, role) + << '\n'; +} + static inline QString paletteToString(const QPalette &palette) { QString result; QTextStream str(&result); - str << "text=" << palette.color(QPalette::WindowText) - << " background=" << palette.color(QPalette::Window); + for (int r = 0; r < QPalette::NColorRoles; ++r) + paletteRoleToString(palette, static_cast<QPalette::ColorRole>(r), str); return result; } @@ -105,9 +120,26 @@ static inline QColor getSysColor(int index) return qColorToCOLORREF(GetSysColor(index)); } +// from QStyle::standardPalette +static inline QPalette standardPalette() +{ + QColor backgroundColor(0xd4, 0xd0, 0xc8); // win 2000 grey + QColor lightColor(backgroundColor.lighter()); + QColor darkColor(backgroundColor.darker()); + const QBrush darkBrush(darkColor); + QColor midColor(Qt::gray); + QPalette palette(Qt::black, backgroundColor, lightColor, darkColor, + midColor, Qt::black, Qt::white); + palette.setBrush(QPalette::Disabled, QPalette::WindowText, darkBrush); + palette.setBrush(QPalette::Disabled, QPalette::Text, darkBrush); + palette.setBrush(QPalette::Disabled, QPalette::ButtonText, darkBrush); + palette.setBrush(QPalette::Disabled, QPalette::Base, QBrush(backgroundColor)); + return palette; +} + static inline QPalette systemPalette() { - QPalette result; + QPalette result = standardPalette(); result.setColor(QPalette::WindowText, getSysColor(COLOR_WINDOWTEXT)); result.setColor(QPalette::Button, getSysColor(COLOR_BTNFACE)); result.setColor(QPalette::Light, getSysColor(COLOR_BTNHIGHLIGHT)); |