Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qcoreapplication_platform.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QCOREAPPLICATION_PLATFORM_H
5#define QCOREAPPLICATION_PLATFORM_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is part of the native interface APIs. Usage of
12// this API may make your code source and binary incompatible
13// with future versions of Qt.
14//
15
16#include <QtCore/qglobal.h>
17#include <QtCore/qnativeinterface.h>
18#include <QtCore/qcoreapplication.h>
19
20#if defined(Q_OS_ANDROID) || defined(Q_QDOC)
21#include <QtCore/qjnitypes.h>
22#if QT_CONFIG(future) && !defined(QT_NO_QOBJECT)
23#include <QtCore/qfuture.h>
24#include <QtCore/qvariant.h>
25#endif
26#endif // #if defined(Q_OS_ANDROID) || defined(Q_QDOC)
27
28#if defined(Q_OS_ANDROID)
29class _jobject;
30typedef _jobject* jobject;
31#endif
32
34
35#if defined(Q_OS_ANDROID)
36Q_DECLARE_JNI_CLASS(Context, "android/content/Context")
37#endif
38
39namespace QNativeInterface
40{
41#if defined(Q_OS_ANDROID) || defined(Q_QDOC)
42struct Q_CORE_EXPORT QAndroidApplication
43{
45#ifdef Q_QDOC
46 static QJniObject context();
47#else
48 static QtJniTypes::Context context();
49#endif
50 static bool isActivityContext();
51 static int sdkVersion();
52 static void hideSplashScreen(int duration = 0);
53
54#if QT_CONFIG(future) && !defined(QT_NO_QOBJECT)
55 static QFuture<QVariant> runOnAndroidMainThread(const std::function<QVariant()> &runnable,
57
58 template <class T>
59 std::enable_if_t<std::is_invocable_v<T> && std::is_same_v<std::invoke_result_t<T>, void>,
60 QFuture<void>> static runOnAndroidMainThread(const T &runnable,
62 {
63 std::function<QVariant()> func = [runnable](){ runnable(); return QVariant(); };
64 return static_cast<QFuture<void>>(runOnAndroidMainThread(func, timeout));
65 }
66#endif
67};
68#endif
69}
70
72
73#endif // QCOREAPPLICATION_PLATFORM_H
\inmodule QtCore
\inmodule QtCore
static constexpr ForeverConstant Forever
\inmodule QtCore
Native interface to a core application on Android.
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
static void * context
#define QT_DECLARE_NATIVE_INTERFACE(...)
GLbitfield GLuint64 timeout
[4]
GLenum func
Definition qopenglext.h:663
QT_BEGIN_NAMESPACE Q_DECLARE_JNI_CLASS(Environment, "android/os/Environment")