summaryrefslogtreecommitdiffstats
path: root/src/gui/styles/qs60style.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/styles/qs60style.cpp')
-rw-r--r--src/gui/styles/qs60style.cpp92
1 files changed, 42 insertions, 50 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index f3213e9..d88b9ee 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -479,7 +479,7 @@ int QS60StylePrivate::focusRectPenWidth()
return pixelMetric(QS60Style::PM_DefaultFrameWidth);
}
-void QS60StylePrivate::setThemePalette(QWidget *widget) const
+void QS60StylePrivate::setThemePalette(QApplication *app) const
{
QPalette widgetPalette = QPalette(Qt::white);
@@ -502,7 +502,7 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const
QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0));
// set these as transparent so that styled full screen theme background is visible
widgetPalette.setColor(QPalette::AlternateBase, Qt::transparent);
- widgetPalette.setColor(QPalette::Window, Qt::transparent);
+ widgetPalette.setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture());
widgetPalette.setColor(QPalette::Base, Qt::transparent);
// set button and tooltipbase based on pixel colors
QColor buttonColor = colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal);
@@ -515,31 +515,14 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const
QColor toolTipColor = colorFromFrameGraphics(QS60StylePrivate::SF_ToolTip);
widgetPalette.setColor(QPalette::ToolTipBase, toolTipColor );
- // widget specific colors
- if (QSlider *slider = qobject_cast<QSlider *>(widget)){
- widgetPalette.setColor(QPalette::All, QPalette::WindowText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0));
- } else if (QPushButton *button = qobject_cast<QPushButton *>(widget)){
- widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
- widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
- } else if (QHeaderView *table = qobject_cast<QHeaderView *>(widget)){
- widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
- } else if (QMenuBar *menuBar = qobject_cast<QMenuBar *>(widget)){
- widgetPalette.setColor(QPalette::All, QPalette::ButtonText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0));
- } else if (QTabBar *tabBar = qobject_cast<QTabBar *>(widget)){
- widgetPalette.setColor(QPalette::Active, QPalette::WindowText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0));
- } else if (QTableView *table = qobject_cast<QTableView *>(widget)){
- widgetPalette.setColor(QPalette::All, QPalette::Text,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0));
- }
+ app->setPalette(widgetPalette);
+}
- if (widget)
- widget->setPalette(widgetPalette);
+void QS60Style::polish(QApplication *application)
+{
+ Q_D(const QS60Style);
+ originalPalette = application->palette();
+ d->setThemePalette(application);
}
void QS60Style::polish(QWidget *widget)
@@ -547,17 +530,6 @@ void QS60Style::polish(QWidget *widget)
Q_D(const QS60Style);
QCommonStyle::polish(widget);
- if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(widget)){
- scrollArea->viewport()->setAutoFillBackground(false);
- }
-
- if (false
-#ifndef QT_NO_SCROLLBAR
- || qobject_cast<QScrollBar *>(widget)
-#endif
- ) {
- widget->setAttribute(Qt::WA_OpaquePaintEvent, false);
- }
if (QS60StylePrivate::isSkinnableDialog(widget)) {
widget->setAttribute(Qt::WA_StyledBackground);
} else if (false
@@ -574,25 +546,45 @@ void QS60Style::polish(QWidget *widget)
widget->setAttribute(Qt::WA_StyledBackground);
}
- if (widget){
- d->setThemePalette(widget);
+ QPalette widgetPalette = widget->palette();
+
+ // widget specific colors
+ if (QSlider *slider = qobject_cast<QSlider *>(widget)){
+ widgetPalette.setColor(QPalette::All, QPalette::WindowText,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0));
+ QApplication::setPalette(widgetPalette, "QSlider");
+ } else if (QPushButton *button = qobject_cast<QPushButton *>(widget)){
+ widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
+ widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
+ QApplication::setPalette(widgetPalette, "QPushButton");
+ } else if (QHeaderView *table = qobject_cast<QHeaderView *>(widget)){
+ widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
+ QApplication::setPalette(widgetPalette, "QHeaderView");
+ } else if (QMenuBar *menuBar = qobject_cast<QMenuBar *>(widget)){
+ widgetPalette.setColor(QPalette::All, QPalette::ButtonText,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0));
+ QApplication::setPalette(widgetPalette, "QMenuBar");
+ } else if (QTabBar *tabBar = qobject_cast<QTabBar *>(widget)){
+ widgetPalette.setColor(QPalette::Active, QPalette::WindowText,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0));
+ QApplication::setPalette(widgetPalette, "QTabBar");
+ } else if (QTableView *table = qobject_cast<QTableView *>(widget)){
+ widgetPalette.setColor(QPalette::All, QPalette::Text,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0));
+ QApplication::setPalette(widgetPalette, "QTableView");
}
+}
+void QS60Style::unpolish(QApplication *application)
+{
+ application->setPalette(originalPalette);
}
void QS60Style::unpolish(QWidget *widget)
{
- if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(widget)){
- scrollArea->viewport()->setAutoFillBackground(true);
- }
-
- if (false
-#ifndef QT_NO_SCROLLBAR
- || qobject_cast<QScrollBar *>(widget)
-#endif
- ) {
- widget->setAttribute(Qt::WA_OpaquePaintEvent);
- }
if (QS60StylePrivate::isSkinnableDialog(widget)) {
widget->setAttribute(Qt::WA_StyledBackground, false);
} else if (false