10#include <QtCore/private/qjnihelpers_p.h>
11#include <QtCore/QJniObject>
19void QAndroidSystemLocale::getLocaleFromJava()
const
25 if (!javaActivity.isValid())
27 if (javaActivity.isValid()) {
28 QJniObject resources = javaActivity.callObjectMethod(
"getResources",
"()Landroid/content/res/Resources;");
29 QJniObject configuration = resources.callObjectMethod(
"getConfiguration",
"()Landroid/content/res/Configuration;");
31 javaLocaleObject = configuration.getObjectField(
"locale",
"Ljava/util/Locale;");
33 javaLocaleObject = QJniObject::callStaticObjectMethod(
"java/util/Locale",
"getDefault",
"()Ljava/util/Locale;");
36 QString languageCode = javaLocaleObject.callObjectMethod(
"getLanguage",
"()Ljava/lang/String;").toString();
37 QString countryCode = javaLocaleObject.callObjectMethod(
"getCountry",
"()Ljava/lang/String;").toString();
39 m_locale =
QLocale(languageCode + u
'_' + countryCode);
119 switch (
in.metaType().id()) {
122 case QMetaType::UInt:
124 case QMetaType::Double:
126 case QMetaType::LongLong:
128 case QMetaType::ULongLong:
146 QJniObject::callStaticObjectMethod(
"android/os/LocaleList",
"getDefault",
147 "()Landroid/os/LocaleList;");
148 if (localeListObject.isValid()) {
149 QString lang = localeListObject.callObjectMethod(
"toLanguageTags",
150 "()Ljava/lang/String;").toString();
QLocale fallbackLocale() const override
QVariant query(QueryType type, QVariant in) const override
QString decimalPoint() const
QString quoteString(const QString &str, QuotationStyle style=StandardQuotation) const
QString dateTimeFormat(FormatType format=LongFormat) const
QString zeroDigit() const
QString dateFormat(FormatType format=LongFormat) const
QString negativeSign() const
Qt::DayOfWeek firstDayOfWeek() const
QString dayName(int, FormatType format=LongFormat) const
QString toCurrencyString(qlonglong, const QString &symbol=QString()) const
QString timeFormat(FormatType format=LongFormat) const
QString groupSeparator() const
QString createSeparatedList(const QStringList &strl) const
QString monthName(int, FormatType format=LongFormat) const
QString positiveSign() const
QString toString(qlonglong i) const
Returns a localized string representation of i.
QString standaloneMonthName(int, FormatType format=LongFormat) const
QString standaloneDayName(int, FormatType format=LongFormat) const
QString currencySymbol(CurrencySymbolFormat=CurrencySymbol) const
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QStringList split(const QString &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
qsizetype length() const
Returns the number of characters in this string.
@ StringToAlternateQuotation
@ StandaloneMonthNameLong
@ StandaloneDayNameNarrow
@ StandaloneMonthNameNarrow
@ StringToStandardQuotation
@ StandaloneMonthNameShort
Combined button and popup list for selecting options.
Q_CORE_EXPORT jint androidSdkVersion()
QtJniTypes::Activity activity()
QtJniTypes::Service service()
#define Q_ASSERT_X(cond, x, msg)