diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-08 12:33:23 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-16 08:36:58 +0200 |
commit | 0b92a93e8e165520b12cb8ca1d0a8812ed6e046b (patch) | |
tree | abd70e7ce9477a31578d85d499ba69052d2befc5 /src/imports | |
parent | 7dab889190b2289a7c4b48e732d7cb7838dbf297 (diff) |
Avoid various warnings about deprected QMetaType methods
Change-Id: I8f4b2703fdd08ff341904219cec33c321e0511c7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/labsmodels/qqmldelegatecomponent.cpp | 4 | ||||
-rw-r--r-- | src/imports/labsmodels/qqmltablemodel.cpp | 8 | ||||
-rw-r--r-- | src/imports/settings/qqmlsettings.cpp | 3 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/imports/labsmodels/qqmldelegatecomponent.cpp b/src/imports/labsmodels/qqmldelegatecomponent.cpp index b8eb8049b3..68c1d3d741 100644 --- a/src/imports/labsmodels/qqmldelegatecomponent.cpp +++ b/src/imports/labsmodels/qqmldelegatecomponent.cpp @@ -313,9 +313,9 @@ QQmlComponent *QQmlDelegateChooser::delegate(QQmlAdaptorModel *adaptorModel, int v = value(adaptorModel, row, column, QStringLiteral("modelData")); if (v.isValid()) { - if (v.canConvert(QMetaType::QVariantMap)) + if (v.canConvert(QMetaType(QMetaType::QVariantMap))) v = v.toMap().value(m_role); - else if (v.canConvert(QMetaType::QObjectStar)) + else if (v.canConvert(QMetaType(QMetaType::QObjectStar))) v = v.value<QObject*>()->property(m_role.toUtf8()); } } diff --git a/src/imports/labsmodels/qqmltablemodel.cpp b/src/imports/labsmodels/qqmltablemodel.cpp index 5a2d68780c..2a39184980 100644 --- a/src/imports/labsmodels/qqmltablemodel.cpp +++ b/src/imports/labsmodels/qqmltablemodel.cpp @@ -863,14 +863,14 @@ bool QQmlTableModel::setData(const QModelIndex &index, const QVariant &value, in const ColumnRoleMetadata roleData = columnMetadata.roles.value(roleName); QVariant effectiveValue = value; if (value.userType() != roleData.type) { - if (!value.canConvert(int(roleData.type))) { + if (!value.canConvert(QMetaType(roleData.type))) { qmlWarning(this).nospace() << "setData(): the value " << value << " set at row " << row << " column " << column << " with role " << roleName << " cannot be converted to " << roleData.typeName; return false; } - if (!effectiveValue.convert(int(roleData.type))) { + if (!effectiveValue.convert(QMetaType(roleData.type))) { qmlWarning(this).nospace() << "setData(): failed converting value " << value << " set at row " << row << " column " << column << " with role " << roleName << " to " << roleData.typeName; @@ -1045,7 +1045,7 @@ bool QQmlTableModel::validateNewRow(const char *functionName, const QVariant &ro const QVariant rolePropertyValue = rowAsMap.value(roleData.name); if (rolePropertyValue.userType() != roleData.type) { - if (!rolePropertyValue.canConvert(int(roleData.type))) { + if (!rolePropertyValue.canConvert(QMetaType(roleData.type))) { qmlWarning(this).quote() << functionName << ": expected the property named " << roleData.name << " to be of type " << roleData.typeName << ", but got " << QString::fromLatin1(rolePropertyValue.typeName()) @@ -1054,7 +1054,7 @@ bool QQmlTableModel::validateNewRow(const char *functionName, const QVariant &ro } QVariant effectiveValue = rolePropertyValue; - if (!effectiveValue.convert(int(roleData.type))) { + if (!effectiveValue.convert(QMetaType(roleData.type))) { qmlWarning(this).nospace() << functionName << ": failed converting value " << rolePropertyValue << " set at column " << columnIndex << " with role " << QString::fromLatin1(rolePropertyValue.typeName()) << " to " diff --git a/src/imports/settings/qqmlsettings.cpp b/src/imports/settings/qqmlsettings.cpp index de45f87638..50308b30a9 100644 --- a/src/imports/settings/qqmlsettings.cpp +++ b/src/imports/settings/qqmlsettings.cpp @@ -335,7 +335,8 @@ void QQmlSettingsPrivate::load() const QVariant currentValue = instance()->value(property.name(), previousValue); if (!currentValue.isNull() && (!previousValue.isValid() - || (currentValue.canConvert(previousValue.userType()) && previousValue != currentValue))) { + || (currentValue.canConvert(previousValue.metaType()) + && previousValue != currentValue))) { property.write(q, currentValue); qCDebug(lcSettings) << "QQmlSettings: load" << property.name() << "setting:" << currentValue << "default:" << previousValue; } |