summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/styles/qs60style.cpp68
-rw-r--r--src/gui/styles/qs60style.h3
-rw-r--r--src/gui/styles/qs60style_p.h2
-rw-r--r--src/gui/styles/qs60style_symbian.cpp10
4 files changed, 50 insertions, 33 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index d7ed1e5..d197a92 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -462,7 +462,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);
@@ -498,31 +498,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)
@@ -546,10 +529,41 @@ 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)
diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h
index 253eb61..945e182 100644
--- a/src/gui/styles/qs60style.h
+++ b/src/gui/styles/qs60style.h
@@ -45,6 +45,8 @@ public:
QRect subElementRect(SubElement element, const QStyleOption *opt, const QWidget *widget = 0) const;
void polish(QWidget *widget);
void unpolish(QWidget *widget);
+ void polish(QApplication *application);
+ void unpolish(QApplication *application);
void setStyleProperty(const char *name, const QVariant &value);
QVariant styleProperty(const char *name) const;
@@ -69,6 +71,7 @@ protected slots:
private:
Q_DISABLE_COPY(QS60Style)
friend class QStyleFactory;
+ QPalette originalPalette;
};
#endif // QT_NO_STYLE_S60
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index c11d89a..88f0864 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -307,7 +307,7 @@ public:
static bool isTouchSupported();
// calculates average color based on button skin graphics (minus borders).
QColor colorFromFrameGraphics(QS60StylePrivate::SkinFrameElements frame) const;
- void setThemePalette(QWidget *widget) const;
+ void setThemePalette(QApplication *application) const;
static int focusRectPenWidth();
diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_symbian.cpp
index 083e3b9..426f8d9 100644
--- a/src/gui/styles/qs60style_symbian.cpp
+++ b/src/gui/styles/qs60style_symbian.cpp
@@ -969,18 +969,18 @@ void QS60Style::handleDynamicLayoutVariantSwitch()
d->setActiveLayout();
#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED
d->refreshUI();
+ d->setThemePalette(qApp);
foreach (QWidget *widget, QApplication::allWidgets())
- d->setThemePalette(widget);
+ widget->ensurePolished();
}
void QS60Style::handleSkinChange()
{
Q_D(QS60Style);
d->clearCaches();
- foreach (QWidget *topLevelWidget, QApplication::allWidgets()){
- d->setThemePalette(topLevelWidget);
- topLevelWidget->update();
- }
+ d->setThemePalette(qApp);
+ foreach (QWidget *topLevelWidget, QApplication::allWidgets())
+ topLevelWidget->ensurePolished();
}
QT_END_NAMESPACE