From 15384f3017978a3d552077c8400b018efcfd793c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Mon, 16 Nov 2009 10:26:33 +0200 Subject: Define own palette for web-based widgets in QS60Style It makes no sense to use the S60-theme based palette in web based widgets. Web pages do not generally show theme background, but their own (or by default white) which clashes badly with WindowText and Text that are set to work with theme background. Therefore, QWebView and QGraphicsWebView need to be set their own palette for texts in theme palette hash. This improves visibility of text in webkit when QS60Style is active. Task-number: QTBUG-4885 Reviewed-by: Janne Koskinen --- src/gui/styles/qs60style.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 939ea45..7c3e11f 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -783,6 +783,14 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const widgetPalette.setBrush(QPalette::Window, QBrush()); QApplication::setPalette(widgetPalette, "QScrollArea"); widgetPalette = *palette; + + //Webpages should not use S60 theme colors as they are designed to work + //with themeBackground and do not generally mesh well with web page backgrounds. + QPalette webPalette = *palette; + webPalette.setColor(QPalette::WindowText, Qt::black); + webPalette.setColor(QPalette::Text, Qt::black); + QApplication::setPalette(webPalette, "QWebView"); + QApplication::setPalette(webPalette, "QGraphicsWebView"); } QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlags flags) @@ -2007,7 +2015,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti buttonRect.adjust(0,-newY,0,-newY); painter->save(); - QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnIconColors, 13, option); + QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnTextColors, 6, option); QColor buttonTextColor = option->palette.buttonText().color(); if (themeColor != buttonTextColor) painter->setPen(buttonTextColor); -- cgit v0.12