diff options
author | Tinja Paavoseppä <tinja.paavoseppa@qt.io> | 2024-01-10 16:21:57 +0200 |
---|---|---|
committer | Tinja Paavoseppä <tinja.paavoseppa@qt.io> | 2024-01-21 15:46:30 +0200 |
commit | 06d2aa91eb4faafc0e52faafeb184d6d3da671ab (patch) | |
tree | f2dd96b93fc663ce2cfcc5319c5233eb822c1f0b /tests/auto/corelib/platform/android/tst_android.cpp | |
parent | 52a41bac775bea9057acbc4344a29bb7e63297e3 (diff) |
Android: Add a context delegate for embedding QML to native Android
When we are embedding a QML view to a non-Qt Android app, there are a lot
of functionalities that are shared with the refular Qt Android app, but
some are not. We should not, for example, try to control the hosting
Activity.
Create a base class that both the QtActivityDelegate, used for the
standard Qt for Android app, and the delegate for the embedding case
can extend.
In this commit, the QtEmbeddedDelegate is very simple, the
biggest difference to QtActivityDelegate being it does not create
a QtLayout or instantiate a QtAccessibilityDelegate.
It does start the Qt app, without waiting for a layout, and register
to listen for changes in the state of the Qt app.
Taking the embedded delegate into use, loading the embedded QML
views and their handling is added in a follow up commit.
Task-number: QTBUG-118872
Pick-to: 6.7
Change-Id: Id390a2b35c70b35880523886bf6fcf59d420cb42
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'tests/auto/corelib/platform/android/tst_android.cpp')
-rw-r--r-- | tests/auto/corelib/platform/android/tst_android.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/auto/corelib/platform/android/tst_android.cpp b/tests/auto/corelib/platform/android/tst_android.cpp index 02204abcb5..f597499782 100644 --- a/tests/auto/corelib/platform/android/tst_android.cpp +++ b/tests/auto/corelib/platform/android/tst_android.cpp @@ -203,13 +203,13 @@ void tst_Android::testRunOnAndroidMainThread() } } -Q_DECLARE_JNI_CLASS(QtActivityDelegate, "org/qtproject/qt/android/QtActivityDelegate") +Q_DECLARE_JNI_CLASS(QtActivityDelegateBase, "org/qtproject/qt/android/QtActivityDelegateBase") void setSystemUiVisibility(int visibility) { QNativeInterface::QAndroidApplication::runOnAndroidMainThread([visibility] { auto context = QNativeInterface::QAndroidApplication::context(); - auto activityDelegate = context.callMethod<QtJniTypes::QtActivityDelegate>("getActivityDelegate"); + auto activityDelegate = context.callMethod<QtJniTypes::QtActivityDelegateBase>("getActivityDelegate"); activityDelegate.callMethod<void>("setSystemUiVisibility", jint(visibility)); }).waitForFinished(); } @@ -342,4 +342,3 @@ void tst_Android::orientationChange() QTEST_MAIN(tst_Android) #include "tst_android.moc" - |