aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@qt.io>2020-01-13 18:24:38 +0100
committerDominik Holland <dominik.holland@qt.io>2020-01-14 12:21:11 +0000
commitf576854c1bf1db7e2abf15dd16d7fb323db6cc36 (patch)
treea7339aede4db8dd9e250bd3523d5b4dff0066c3e
parente11701cd49210033ff64577417df50dadd0b2c83 (diff)
Also register all basic PendingReply type on QCoreApplication startup
This is needed as otherwise a QPendingReply is not accepted as a return value of a function called from QML. Change-Id: Iaaed897aa0c49874e705779032d4cd14d4664998 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
-rw-r--r--src/ivicore/qivipendingreply.cpp13
-rw-r--r--src/ivicore/qivipendingreply.h2
2 files changed, 14 insertions, 1 deletions
diff --git a/src/ivicore/qivipendingreply.cpp b/src/ivicore/qivipendingreply.cpp
index e7766f4..2caa926 100644
--- a/src/ivicore/qivipendingreply.cpp
+++ b/src/ivicore/qivipendingreply.cpp
@@ -59,7 +59,16 @@ QT_BEGIN_NAMESPACE
#define QTIVI_ADD_STATIC_METATYPE(MetaTypeName, MetaTypeId, AliasingType) \
QTIVI_ADD_STATIC_METATYPE2(MetaTypeName, MetaTypeId, AliasingType, nullptr)
-static void qiviRegisterPendingReplyBasicTypes() {
+
+/*!
+ \relates QIviPendingReply
+
+ Registers QIviPendingReplys of all Qt basic types to the meta type system.
+
+ Usually this function called automatically when creating a QCoreApplication or a QIviPendingReply
+ and doesn't need to be called manually.
+*/
+void qiviRegisterPendingReplyBasicTypes() {
static bool once = false;
if (once)
return;
@@ -74,6 +83,8 @@ static void qiviRegisterPendingReplyBasicTypes() {
once = true;
}
+Q_COREAPP_STARTUP_FUNCTION(qiviRegisterPendingReplyBasicTypes)
+
// TODO make it reentrant
QIviPendingReplyWatcherPrivate::QIviPendingReplyWatcherPrivate(int userType, QIviPendingReplyWatcher *parent)
diff --git a/src/ivicore/qivipendingreply.h b/src/ivicore/qivipendingreply.h
index e0b5aeb..36368b8 100644
--- a/src/ivicore/qivipendingreply.h
+++ b/src/ivicore/qivipendingreply.h
@@ -55,6 +55,8 @@ QT_BEGIN_NAMESPACE
class QIviPendingReplyWatcherPrivate;
+Q_QTIVICORE_EXPORT void qiviRegisterPendingReplyBasicTypes();
+
class Q_QTIVICORE_EXPORT QIviPendingReplyWatcher : public QObject
{
Q_OBJECT