aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals.cid@kdab.com>2019-01-03 10:49:58 +0100
committerAlbert Astals Cid <albert.astals.cid@kdab.com>2019-01-22 22:24:22 +0000
commit210b6081a58d6616287ee45f66a2c41306c74e7d (patch)
tree3f5bb42bce0fbc1547313d51f3841d56dd842339 /src
parent0f74f5b2dca75dc7fb99e08bb465aac8d7abd572 (diff)
Add a QtAndroid::startActivity that takes a QAndroidIntent
The function simply calls the other startActivity with QAndroidIntent::handle, anyone could do that from the user code, but i think it makes sense the library to allow you doing this directly given you're supposed to pass an intent and we have a class that represents an intent Change-Id: I673cb410b07ed4fd1408a971696a3b5ae3dfd063 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/androidextras/android/qandroidfunctions.cpp21
-rw-r--r--src/androidextras/android/qandroidfunctions.h3
2 files changed, 24 insertions, 0 deletions
diff --git a/src/androidextras/android/qandroidfunctions.cpp b/src/androidextras/android/qandroidfunctions.cpp
index a5ed23d..651cf32 100644
--- a/src/androidextras/android/qandroidfunctions.cpp
+++ b/src/androidextras/android/qandroidfunctions.cpp
@@ -181,6 +181,27 @@ void QtAndroid::startActivity(const QAndroidJniObject &intent,
}
/*!
+ \since 5.13
+
+ Starts the activity given by \a intent and provides the result asynchronously through the
+ \a resultReceiver if this is non-null.
+
+ If \a resultReceiver is null, then the \c startActivity() method in the \c androidActivity()
+ will be called. Otherwise \c startActivityForResult() will be called.
+
+ The \a receiverRequestCode is a request code unique to the \a resultReceiver, and will be
+ returned along with the result, making it possible to use the same receiver for more than
+ one intent.
+
+ */
+void QtAndroid::startActivity(const QAndroidIntent &intent,
+ int receiverRequestCode,
+ QAndroidActivityResultReceiver *resultReceiver)
+{
+ startActivity(intent.handle(), receiverRequestCode, resultReceiver);
+}
+
+/*!
\since 5.3
Starts the activity given by \a intentSender and provides the result asynchronously through the
diff --git a/src/androidextras/android/qandroidfunctions.h b/src/androidextras/android/qandroidfunctions.h
index 8dba435..c6802e8 100644
--- a/src/androidextras/android/qandroidfunctions.h
+++ b/src/androidextras/android/qandroidfunctions.h
@@ -68,6 +68,9 @@ namespace QtAndroid
Q_ANDROIDEXTRAS_EXPORT void startActivity(const QAndroidJniObject &intent,
int receiverRequestCode,
QAndroidActivityResultReceiver *resultReceiver = nullptr);
+ Q_ANDROIDEXTRAS_EXPORT void startActivity(const QAndroidIntent &intent,
+ int receiverRequestCode,
+ QAndroidActivityResultReceiver *resultReceiver = nullptr);
enum class BindFlag {
None = 0x00000000,