summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2020-09-08 10:02:41 +0200
committerJüri Valdmann <juri.valdmann@qt.io>2020-09-10 10:12:04 +0200
commitf8c546b8c3303571504c8c1a2cc3c8d1d7e9e151 (patch)
treec1046db54dda96c8143f069161f0cf4f8b757c60
parent742132bb72514e16ad12ecb4e6b017fff25b697c (diff)
downloadqtwebchannel-f8c546b8c3303571504c8c1a2cc3c8d1d7e9e151.tar.gz
Use QVariant(QMetaType, const void *) constructor
The deprecated QVariant(int, const void *) constructor has been removed in qtbase. The QVariant(QMetaType, const void *) constructor should be used instead. Change-Id: I01a22e1334d0e8ae74be7d9c055cb092ac3d1cf6 Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
-rw-r--r--src/webchannel/qmetaobjectpublisher.cpp4
-rw-r--r--src/webchannel/signalhandler_p.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/webchannel/qmetaobjectpublisher.cpp b/src/webchannel/qmetaobjectpublisher.cpp
index b4a7cce..8cc2a05 100644
--- a/src/webchannel/qmetaobjectpublisher.cpp
+++ b/src/webchannel/qmetaobjectpublisher.cpp
@@ -471,7 +471,7 @@ QVariant QMetaObjectPublisher::invokeMethod(QObject *const object, const QMetaMe
// Only init variant with return type if its not a variant itself, which would
// lead to nested variants which is not what we want.
if (method.returnType() != QMetaType::QVariant)
- returnValue = QVariant(method.returnType(), 0);
+ returnValue = QVariant(QMetaType(method.returnType()), nullptr);
QGenericReturnArgument returnArgument(method.typeName(), returnValue.data());
method.invoke(object, returnArgument,
@@ -669,7 +669,7 @@ QVariant QMetaObjectPublisher::toVariant(const QJsonValue &value, int targetType
return QVariant::fromValue(unwrappedObject);
} else if (isQFlagsType(targetType)) {
int flagsValue = value.toInt();
- return QVariant(targetType, reinterpret_cast<const void*>(&flagsValue));
+ return QVariant(QMetaType(targetType), reinterpret_cast<const void*>(&flagsValue));
}
// this converts QJsonObjects to QVariantMaps, which is not desired when
diff --git a/src/webchannel/signalhandler_p.h b/src/webchannel/signalhandler_p.h
index 8f8c349..8fdf598 100644
--- a/src/webchannel/signalhandler_p.h
+++ b/src/webchannel/signalhandler_p.h
@@ -236,7 +236,7 @@ void SignalHandler<Receiver>::dispatch(const QObject *object, const int signalId
if (type == QMetaType::QVariant) {
arg = *reinterpret_cast<QVariant *>(argumentData[i + 1]);
} else {
- arg = QVariant(type, argumentData[i + 1]);
+ arg = QVariant(QMetaType(type), argumentData[i + 1]);
}
arguments.append(arg);
}