diff options
author | Nick Ratelle <nratelle@qnx.com> | 2012-01-17 23:05:54 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-12 06:54:42 (GMT) |
commit | 25c4ce6deef20c69d00fe1197a60e8b7587c81cb (patch) | |
tree | 4ab2fdd19e5313db6e37951ea703af5885007d40 /src/gui | |
parent | 5a7619a459bce4fe0011044e7a1a2cff1297f800 (diff) | |
download | Qt-25c4ce6deef20c69d00fe1197a60e8b7587c81cb.zip Qt-25c4ce6deef20c69d00fe1197a60e8b7587c81cb.tar.gz Qt-25c4ce6deef20c69d00fe1197a60e8b7587c81cb.tar.bz2 |
Support changing locales at runtime in QPA plugins.
Change-Id: Id65798b81db2fa9fb5b1d929e4a94103995c6707
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_qpa.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_qpa.cpp | 11 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_qpa.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_qpa_p.h | 10 |
5 files changed, 31 insertions, 2 deletions
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 31d0b75..74b0ee5 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -507,7 +507,7 @@ public: static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e); // static void reportAvailableGeometryChange(int screenIndex); static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e); - + static void reportLocaleChange(); #endif #ifdef Q_WS_QWS diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index 6b00258..242b5ef 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -130,6 +130,9 @@ void QApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate QApplicationPrivate::reportAvailableGeometryChange( static_cast<QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *>(e)); break; + case QWindowSystemInterfacePrivate::LocaleChange: + QApplicationPrivate::reportLocaleChange(); + break; default: qWarning() << "Unknown user input event type:" << e->type; break; @@ -981,4 +984,9 @@ void QApplicationPrivate::reportAvailableGeometryChange( } } +void QApplicationPrivate::reportLocaleChange() +{ + QApplication::sendSpontaneousEvent( qApp, new QEvent( QEvent::LocaleChange ) ); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index 97e4e65..24fc664 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -42,6 +42,7 @@ #include "qwindowsysteminterface_qpa_p.h" #include "qapplication_p.h" #include <QAbstractEventDispatcher> +#include <private/qlocale_p.h> QT_BEGIN_NAMESPACE @@ -288,4 +289,14 @@ void QWindowSystemInterface::handleScreenCountChange(int count) QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } +void QWindowSystemInterface::handleLocaleChange() +{ + QWindowSystemInterfacePrivate::LocaleChangeEvent *e = + new QWindowSystemInterfacePrivate::LocaleChangeEvent(); + + QLocalePrivate::updateSystemPrivate(); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + + QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 064b68c..c8f660d 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -100,6 +100,8 @@ public: static void handleScreenGeometryChange(int screenIndex); static void handleScreenAvailableGeometryChange(int screenIndex); static void handleScreenCountChange(int count); + + static void handleLocaleChange(); }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index f26b8ee..4ff65f9 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -61,7 +61,8 @@ public: Touch, ScreenGeometry, ScreenAvailableGeometry, - ScreenCountChange + ScreenCountChange, + LocaleChange }; class WindowSystemEvent { @@ -193,6 +194,13 @@ public: int index; }; + class LocaleChangeEvent : public WindowSystemEvent { + public: + LocaleChangeEvent() + : WindowSystemEvent(LocaleChange) { } + }; + + static QList<WindowSystemEvent *> windowSystemEventQueue; static QMutex queueMutex; |