Add sdkVersion() to QNativeInterface::QAndroidApplication

The androidSdkVersion() is probably the most used call from
QtAndroidPrivate, so instead of waiting long time for a cross platform
api that could offer this functionality, it's better to have it now
under the NativeInterface.

Task-number: QTBUG-90497
Change-Id: I008d4c77d347d36e0a7e8ca4d6f33f993b02511b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Assam Boudjelthia 2021-05-05 19:39:13 +03:00
parent c4961c0fbe
commit 3a4a8398ab
2 changed files with 12 additions and 0 deletions

View File

@ -57,6 +57,7 @@ struct Q_CORE_EXPORT QAndroidApplication
QT_DECLARE_NATIVE_INTERFACE(QAndroidApplication)
static jobject context();
static bool isActivityContext();
static int sdkVersion();
};
#endif
}

View File

@ -82,4 +82,15 @@ bool QNativeInterface::QAndroidApplication::isActivityContext()
return QtAndroidPrivate::activity();
}
/*!
\fn int QNativeInterface::QAndroidApplication::sdkVersion()
Returns the Android SDK version. This is also known as the API level.
\since 6.2
*/
int QNativeInterface::QAndroidApplication::sdkVersion()
{
return QtAndroidPrivate::androidSdkVersion();
}
QT_END_NAMESPACE