aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-27 07:44:20 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-27 09:35:50 +0000
commitac2eb96b1983aa09f2d95a060b5dc31df228f33d (patch)
tree86d3e257bbeebfef2205bde61c16b6f80b556e9e /sources
parentd3ee9402ebc0abcf973ea8a7f4268c9f6aacd364 (diff)
libpyside: Fix deprecation warnings about constructing a QVariant from a type id
Build the QVariant from the QMetaType, fixing warning like: libpyside/pysidemetafunction.cpp:186:64: warning: ‘Type’ is deprecated: Use QMetaType::Type instead. [-Wdeprecated-declarations] /libpyside/pysidemetafunction.cpp:186:77: warning: ‘QVariant::QVariant(QVariant::Type)’ is deprecated: Use the constructor taking a QMetaType instead. [-Wdeprecated-declarations] Change-Id: I5c9c4d775ef58ecf17326c112c5130c43fe1a09b Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside2/libpyside/pysidemetafunction.cpp8
-rw-r--r--sources/pyside2/tests/pysidetest/testobject.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/sources/pyside2/libpyside/pysidemetafunction.cpp b/sources/pyside2/libpyside/pysidemetafunction.cpp
index 0b7799af1..96ed953b6 100644
--- a/sources/pyside2/libpyside/pysidemetafunction.cpp
+++ b/sources/pyside2/libpyside/pysidemetafunction.cpp
@@ -176,19 +176,19 @@ bool call(QObject *self, int methodIndex, PyObject *args, PyObject **retVal)
Shiboken::Conversions::SpecificConverter converter(typeName);
if (converter) {
- int typeId = QMetaType::fromName(typeName).id();
+ QMetaType metaType = QMetaType::fromName(typeName);
if (!Shiboken::Conversions::pythonTypeIsObjectType(converter)) {
- if (!typeId) {
+ if (!metaType.isValid()) {
PyErr_Format(PyExc_TypeError, "Value types used on meta functions (including signals) need to be "
"registered on meta type: %s", typeName.data());
break;
}
- methValues[i] = QVariant(static_cast<QVariant::Type>(typeId));
+ methValues[i] = QVariant(metaType);
}
methArgs[i] = methValues[i].data();
if (i == 0) // Don't do this for return type
continue;
- if (typeId == QVariant::String) {
+ if (metaType.id() == QMetaType::QString) {
QString tmp;
converter.toCpp(PySequence_Fast_GET_ITEM(sequence.object(), i - 1), &tmp);
methValues[i] = tmp;
diff --git a/sources/pyside2/tests/pysidetest/testobject.h b/sources/pyside2/tests/pysidetest/testobject.h
index 41a97a0db..c31a2ab73 100644
--- a/sources/pyside2/tests/pysidetest/testobject.h
+++ b/sources/pyside2/tests/pysidetest/testobject.h
@@ -55,7 +55,7 @@ class PYSIDETEST_API TestObject : public QObject
Q_OBJECT
public:
static void createApp() { int argc=0; new QApplication(argc, 0); };
- static int checkType(const QVariant& var) { return (int)var.type(); }
+ static int checkType(const QVariant& var) { return var.metaType().id(); }
TestObject(int idValue, QObject* parent = 0) : QObject(parent), m_idValue(idValue) {}
int idValue() const { return m_idValue; }