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.cpp26
-rw-r--r--src/s60main/qts60mainappui.cpp13
-rw-r--r--src/s60main/qts60mainappui.h7
5 files changed, 74 insertions, 29 deletions
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index f9559fa..6088780 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 s60ResourceChangeL(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..dc2b9d3 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::s60ResourceChangeL(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..3aaa839 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -119,6 +119,22 @@ static const int frameElementsCount =
const int KNotFound = -1;
+static void updateWidgets(const QList<QWidget *>& widgets)
+{
+ // This is based on updateWidgets in qstylesheetstyle.cpp.
+
+ for (int i = 0; i < widgets.size(); ++i) {
+ QWidget *widget = const_cast<QWidget *>(widgets.at(i));
+ if (widget == 0)
+ continue;
+ widget->style()->polish(widget);
+ QEvent event(QEvent::StyleChange);
+ qApp->sendEvent(widget, &event);
+ widget->update();
+ widget->updateGeometry();
+ }
+}
+
QS60StylePrivate::~QS60StylePrivate()
{
clearCaches(); //deletes also background image
@@ -584,14 +600,8 @@ 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()));
- }
+{
+ updateWidgets(QApplication::allWidgets());
}
void QS60StylePrivate::setFont(QWidget *widget) const
diff --git a/src/s60main/qts60mainappui.cpp b/src/s60main/qts60mainappui.cpp
index 8467aef..f7e570b 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->s60ResourceChangeL(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.