QCocoaInputContext: Don't emit locale update on startup

We're just resolving the initial locale, via the call site
in the constructor.

Change-Id: I186f4c491c013cce265a855963a8624ce5c6da97
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-09-20 22:11:42 +02:00
parent 500be123f4
commit fa54471050

View File

@ -150,11 +150,18 @@ void QCocoaInputContext::updateLocale()
QString language = QString::fromNSString(languages.firstObject); QString language = QString::fromNSString(languages.firstObject);
QLocale locale(language); QLocale locale(language);
if (m_locale != locale) {
bool localeUpdated = m_locale != locale;
static bool firstUpdate = true;
m_locale = locale;
if (localeUpdated && !firstUpdate) {
qCDebug(lcQpaInputMethods) << "Reporting new locale" << locale; qCDebug(lcQpaInputMethods) << "Reporting new locale" << locale;
m_locale = locale;
emitLocaleChanged(); emitLocaleChanged();
} }
firstUpdate = false;
} }
QT_END_NAMESPACE QT_END_NAMESPACE