summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qapplication.h1
-rw-r--r--src/gui/kernel/qapplication_s60.cpp56
-rw-r--r--src/gui/styles/qs60style.cpp22
-rw-r--r--src/s60main/qts60mainappui.cpp13
-rw-r--r--src/s60main/qts60mainappui.h7
5 files changed, 72 insertions, 27 deletions
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index f9559fa..e1b8b26 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -234,6 +234,7 @@ public:
int s60ProcessEvent(TWsEvent *event);
virtual bool s60EventFilter(TWsEvent *aEvent);
void symbianHandleCommand(int command);
+ void symbianResourceChange(int type);
#endif
#if defined(Q_WS_QWS)
virtual bool qwsEventFilter(QWSEvent *);
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 7b1817f..a05e9bd 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -649,21 +649,7 @@ void QSymbianControl::HandleResourceChange(int resourceType)
// font change event
break;
case KEikDynamicLayoutVariantSwitch:
- {
-#ifndef QT_NO_STYLE_S60
- QS60Style *s60Style = 0;
-
-#ifndef QT_NO_STYLE_STYLESHEET
- QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle*>(QApplication::style());
- if (proxy)
- s60Style = qobject_cast<QS60Style*>(proxy->baseStyle());
- else
-#endif
- s60Style = qobject_cast<QS60Style*>(QApplication::style());
-
- if (s60Style)
- s60Style->handleDynamicLayoutVariantSwitch();
-#endif
+ {
if (qwidget->isFullScreen()) {
SetExtentToWholeScreen();
} else if (qwidget->isMaximized()) {
@@ -672,12 +658,6 @@ void QSymbianControl::HandleResourceChange(int resourceType)
}
break;
}
-#ifndef QT_NO_STYLE_S60
- case KAknsMessageSkinChange:
- if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style()))
- s60Style->handleSkinChange();
- break;
-#endif
default:
break;
}
@@ -1060,6 +1040,40 @@ void QApplication::symbianHandleCommand(int command)
}
}
+void QApplication::symbianResourceChange(int type)
+{
+ switch (type) {
+ case KEikDynamicLayoutVariantSwitch:
+ {
+#ifndef QT_NO_STYLE_S60
+ QS60Style *s60Style = 0;
+
+#ifndef QT_NO_STYLE_STYLESHEET
+ QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle*>(QApplication::style());
+ if (proxy)
+ s60Style = qobject_cast<QS60Style*>(proxy->baseStyle());
+ else
+#endif
+ s60Style = qobject_cast<QS60Style*>(QApplication::style());
+
+ if (s60Style)
+ s60Style->handleDynamicLayoutVariantSwitch();
+#endif
+ }
+ break;
+
+#ifndef QT_NO_STYLE_S60
+ case KAknsMessageSkinChange:
+ if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style()))
+ s60Style->handleSkinChange();
+ break;
+#endif
+
+ default:
+ break;
+ }
+}
+
#ifndef QT_NO_WHEELEVENT
int QApplication::wheelScrollLines()
{
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index fde1cc6..93a3144 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -585,12 +585,22 @@ QPixmap QS60StylePrivate::cachedFrame(SkinFrameElements frame, const QSize &size
void QS60StylePrivate::refreshUI()
{
- foreach (QWidget *topLevelWidget, QApplication::allWidgets()) {
- topLevelWidget->updateGeometry();
- //todo: study how we can get rid of this. Apparently scrollbars cache pixelmetrics values, and we need them to update themselves
- // maybe styleChanged event is enough?
- //QCoreApplication::postEvent(topLevelWidget, new QEvent(QEvent::StyleChange));
- QCoreApplication::postEvent(topLevelWidget, new QResizeEvent(topLevelWidget->size(), topLevelWidget->size()));
+ QList<QWidget *> widgets = QApplication::allWidgets();
+
+ // The following is similar to updateWidgets in qstylesheetstyle.cpp.
+
+ for (int i = 0; i < widgets.size(); ++i) {
+ QWidget *widget = widgets.at(i);
+ if (widget == 0)
+ continue;
+
+ if (widget->style()) {
+ widget->style()->polish(widget);
+ QEvent event(QEvent::StyleChange);
+ qApp->sendEvent(widget, &event);
+ }
+ widget->update();
+ widget->updateGeometry();
}
}
diff --git a/src/s60main/qts60mainappui.cpp b/src/s60main/qts60mainappui.cpp
index 8467aef..49a3342 100644
--- a/src/s60main/qts60mainappui.cpp
+++ b/src/s60main/qts60mainappui.cpp
@@ -76,6 +76,19 @@ void CQtS60MainAppUi::HandleCommandL( TInt aCommand )
qApp->symbianHandleCommand(aCommand);
}
+// -----------------------------------------------------------------------------
+// CQtS60MainAppUi::HandleResourceChangeL()
+// Takes care of event handling.
+// -----------------------------------------------------------------------------
+//
+void CQtS60MainAppUi::HandleResourceChangeL(TInt aType)
+{
+ CAknAppUi::HandleResourceChangeL(aType);
+
+ if (qApp)
+ qApp->symbianResourceChange(aType);
+}
+
void CQtS60MainAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl *control)
{
int result = 0;
diff --git a/src/s60main/qts60mainappui.h b/src/s60main/qts60mainappui.h
index 3addb0c..8124fa3 100644
--- a/src/s60main/qts60mainappui.h
+++ b/src/s60main/qts60mainappui.h
@@ -61,6 +61,13 @@ class CQtS60MainAppUi : public CAknAppUi
void HandleCommandL( TInt aCommand );
/**
+ * From CAknAppUi, HandleResourceChangeL
+ * Handles resource change events such as layout switches in global level.
+ * @param aType event type.
+ */
+ void HandleResourceChangeL(TInt aType);
+
+ /**
* HandleStatusPaneSizeChange.
* Called by the framework when the application status pane
* size is changed.