Warning, file /include/QtCore/qcoreapplication_platform.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QCOREAPPLICATION_PLATFORM_H
0005 #define QCOREAPPLICATION_PLATFORM_H
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include <QtCore/qglobal.h>
0017 #include <QtCore/qnativeinterface.h>
0018 #include <QtCore/qcoreapplication.h>
0019
0020 #if defined(Q_OS_ANDROID) || defined(Q_QDOC)
0021 #include <QtCore/qjnitypes.h>
0022 #if QT_CONFIG(future) && !defined(QT_NO_QOBJECT)
0023 #include <QtCore/qfuture.h>
0024 #include <QtCore/qvariant.h>
0025 #endif
0026 #endif
0027
0028 #if defined(Q_OS_ANDROID)
0029 class _jobject;
0030 typedef _jobject* jobject;
0031 #endif
0032
0033 QT_BEGIN_NAMESPACE
0034
0035 #if defined(Q_OS_ANDROID)
0036 Q_DECLARE_JNI_CLASS(Context, "android/content/Context")
0037 #endif
0038
0039 namespace QNativeInterface
0040 {
0041 #if defined(Q_OS_ANDROID) || defined(Q_QDOC)
0042 struct Q_CORE_EXPORT QAndroidApplication
0043 {
0044 QT_DECLARE_NATIVE_INTERFACE(QAndroidApplication, 1, QCoreApplication)
0045 #ifdef Q_QDOC
0046 static QJniObject context();
0047 #else
0048 static QtJniTypes::Context context();
0049 #endif
0050 static bool isActivityContext();
0051 static int sdkVersion();
0052 static void hideSplashScreen(int duration = 0);
0053
0054 #if QT_CONFIG(future) && !defined(QT_NO_QOBJECT)
0055 static QFuture<QVariant> runOnAndroidMainThread(const std::function<QVariant()> &runnable,
0056 const QDeadlineTimer timeout = QDeadlineTimer::Forever);
0057
0058 template <class T>
0059 std::enable_if_t<std::is_invocable_v<T> && std::is_same_v<std::invoke_result_t<T>, void>,
0060 QFuture<void>> static runOnAndroidMainThread(const T &runnable,
0061 const QDeadlineTimer timeout = QDeadlineTimer::Forever)
0062 {
0063 std::function<QVariant()> func = [runnable](){ runnable(); return QVariant(); };
0064 return static_cast<QFuture<void>>(runOnAndroidMainThread(func, timeout));
0065 }
0066 #endif
0067 };
0068 #endif
0069 }
0070
0071 QT_END_NAMESPACE
0072
0073 #endif