wasm: remove onLanguageChanged event handler
QSystemLocale is setting the global window.onLanguageChanged property which may cause conflicts in cases where there are more than one Qt app instance on the same web page. In addition the QSystemLocale destructor never runs, which breaks also for repeated QLocale instantiations on the same page (for example for the QLocale auto- test) Change-Id: I85af0587527b2922804fc866c83864f677700e6d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 3f74e2a633a809a27e8e66346e052dea48c4369e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c9a9469f55
commit
b2b1d02692
@ -720,17 +720,6 @@ QSystemLocale::QSystemLocale() : next(_systemLocale)
|
||||
_systemLocale = this;
|
||||
|
||||
systemLocaleData.m_language_id = 0;
|
||||
|
||||
#ifdef Q_OS_WASM
|
||||
onLanguageChanged = std::make_unique<qstdweb::EventCallback>(
|
||||
emscripten::val::global("window"), "languagechange", [](emscripten::val) {
|
||||
systemLocaleData.m_language_id = 0;
|
||||
QEvent languageChangeEvent(QEvent::LanguageChange);
|
||||
QCoreApplication::sendEvent(qApp, &languageChangeEvent);
|
||||
QEvent localeChangeEvent(QEvent::LocaleChange);
|
||||
QCoreApplication::sendEvent(qApp, &localeChangeEvent);
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -106,9 +106,6 @@ struct QLocaleData;
|
||||
class Q_CORE_EXPORT QSystemLocale
|
||||
{
|
||||
QSystemLocale *next = nullptr; // Maintains a stack.
|
||||
#ifdef Q_OS_WASM
|
||||
std::unique_ptr<qstdweb::EventCallback> onLanguageChanged;
|
||||
#endif
|
||||
|
||||
public:
|
||||
QSystemLocale();
|
||||
|
Loading…
x
Reference in New Issue
Block a user