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) Pick-to: 6.7 Change-Id: I85af0587527b2922804fc866c83864f677700e6d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
d4f7d2aeab
commit
3f74e2a633
@ -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