diff options
author | BogDan Vatra <bogdan@kdab.com> | 2018-02-06 14:18:31 +0200 |
---|---|---|
committer | BogDan Vatra <bogdan@kdab.com> | 2018-02-07 05:34:56 +0000 |
commit | 9b6aeb9511150f53c46bd3927d956697d34606b3 (patch) | |
tree | f61566f122664479b608e661abd65455706ffe50 /src/androidextras/android/qandroidservice.h | |
parent | bb3c2b9090bd1e1c9664492413c05fedbde575fa (diff) |
Allow the user to easily register a binder creator
Until now the users were forced to subclass QAndroidService in order to
provide the binder. Now is much easier, the user just pass a lambda in
the QAndroidService constructor e.g.
QAndroidService app(argc, argv, [](const QAndroidIntent &){ return new
MyBinder{};});
Change-Id: I97608f806b311ad3c853a86cde132aea8352349b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/androidextras/android/qandroidservice.h')
-rw-r--r-- | src/androidextras/android/qandroidservice.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/androidextras/android/qandroidservice.h b/src/androidextras/android/qandroidservice.h index 72e47a4..8c0855c 100644 --- a/src/androidextras/android/qandroidservice.h +++ b/src/androidextras/android/qandroidservice.h @@ -43,6 +43,7 @@ #include <QtAndroidExtras/qandroidextrasglobal.h> #include <QCoreApplication> #include <QSharedPointer> +#include <functional> QT_BEGIN_NAMESPACE class QAndroidServicePrivate; @@ -56,6 +57,12 @@ public: , int flags = ApplicationFlags #endif ); + QAndroidService(int &argc, char **argv, + const std::function<QAndroidBinder*(const QAndroidIntent &intent)> & binder +#ifndef Q_QDOC + , int flags = ApplicationFlags +#endif + ); virtual ~QAndroidService(); virtual QAndroidBinder* onBind(const QAndroidIntent &intent); |