aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlproperty.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-09-08 12:33:23 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-09-16 08:36:58 +0200
commit0b92a93e8e165520b12cb8ca1d0a8812ed6e046b (patch)
treeabd70e7ce9477a31578d85d499ba69052d2befc5 /src/qml/qml/qqmlproperty.cpp
parent7dab889190b2289a7c4b48e732d7cb7838dbf297 (diff)
Avoid various warnings about deprected QMetaType methods
Change-Id: I8f4b2703fdd08ff341904219cec33c321e0511c7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r--src/qml/qml/qqmlproperty.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 0de097e81e..afdec1d450 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -1150,12 +1150,13 @@ bool QQmlPropertyPrivate::writeEnumProperty(const QMetaProperty &prop, int idx,
if (!ok)
return false;
} else if (v.userType() != QMetaType::Int && v.userType() != QMetaType::UInt) {
- int enumMetaTypeId = QMetaType::type(QByteArray(menum.scope() + QByteArray("::") + menum.name()));
+ int enumMetaTypeId = QMetaType::fromName(
+ QByteArray(menum.scope() + QByteArray("::") + menum.name())).id();
if ((enumMetaTypeId == QMetaType::UnknownType) || (v.userType() != enumMetaTypeId) || !v.constData())
return false;
v = QVariant(*reinterpret_cast<const int *>(v.constData()));
}
- v.convert(QMetaType::Int);
+ v.convert(QMetaType(QMetaType::Int));
}
// the status variable is changed by qt_metacall to indicate what it did
@@ -1226,7 +1227,7 @@ bool QQmlPropertyPrivate::write(
double integral;
double fractional = std::modf(value.toDouble(), &integral);
if (qFuzzyIsNull(fractional))
- v.convert(QMetaType::Int);
+ v.convert(QMetaType(QMetaType::Int));
}
return writeEnumProperty(prop, property.coreIndex(), object, v, flags);
}
@@ -1265,7 +1266,9 @@ bool QQmlPropertyPrivate::write(
} else {
return false;
}
- } else if (value.canConvert(propertyType) && !isUrl && variantType != QMetaType::QString && propertyType != qMetaTypeId<QList<QUrl>>() && !property.isQList()) {
+ } else if (value.canConvert(QMetaType(propertyType))
+ && !isUrl && variantType != QMetaType::QString
+ && propertyType != qMetaTypeId<QList<QUrl>>() && !property.isQList()) {
// common cases:
switch (propertyType) {
case QMetaType::Bool: {
@@ -1290,7 +1293,7 @@ bool QQmlPropertyPrivate::write(
}
default: { // "fallback":
QVariant v = value;
- v.convert(propertyType);
+ v.convert(QMetaType(propertyType));
return property.writeProperty(object, const_cast<void *>(v.constData()), flags);
}
}
@@ -1367,7 +1370,7 @@ bool QQmlPropertyPrivate::write(
if (!ok) {
v = value;
- if (v.convert(propertyType)) {
+ if (v.convert(QMetaType(propertyType))) {
ok = true;
} else if (v.isValid() && value.isNull()) {
// For historical reasons converting a null QVariant to another type will do the trick