diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2019-12-02 17:54:48 +0100 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2020-01-23 16:46:51 +0100 |
commit | 73d1476fb1397948a4d806bd921fce372bd8d63b (patch) | |
tree | a476349c26627027d78c1279da00ef633323311f /src/corelib/kernel/qmetaobject.cpp | |
parent | a78d66743171557d79b16c08be775e3ac15bb4ef (diff) |
Replace most use of QVariant::type and occurrences of QVariant::Type
I made a clazy automated check that replaced the use of QVariant::Type
by the equivalent in QMetaType.
This has been deprecated since Qt 5.0, but many uses were not yet removed.
In addition, there was some manual changes to fix the compilation errors.
Adapted the Private API of QDateTimeParser and QMimeDataPrivate
and adjust QDateTimeEdit and QSpinBox.
QVariant(QVariant::Invalid) in qstylesheet made no sense.
But note that in QVariant::save, we actually wanted to use the non-user type.
In the SQL module, many changes were actually reverted because the API
still expects QVarient::Type.
Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/kernel/qmetaobject.cpp')
-rw-r--r-- | src/corelib/kernel/qmetaobject.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index fad47eee13..347fb1eb87 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -2982,7 +2982,7 @@ int QMetaProperty::userType() const if (type == QMetaType::UnknownType) { type = registerPropertyType(); if (type == QMetaType::UnknownType) - return QVariant::Int; // Match behavior of QMetaType::type() + return QMetaType::Int; // Match behavior of QMetaType::type() } return type; } @@ -3100,7 +3100,7 @@ QVariant QMetaProperty::read(const QObject *object) const if (!object || !mobj) return QVariant(); - uint t = QVariant::Int; + uint t = QMetaType::Int; if (isEnumType()) { /* try to create a QVariant that can be converted to this enum @@ -3177,9 +3177,9 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const return false; QVariant v = value; - uint t = QVariant::Invalid; + uint t = QMetaType::UnknownType; if (isEnumType()) { - if (v.type() == QVariant::String) { + if (v.userType() == QMetaType::QString) { bool ok; if (isFlagType()) v = QVariant(menum.keysToValue(value.toByteArray(), &ok)); @@ -3187,13 +3187,13 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const v = QVariant(menum.keyToValue(value.toByteArray(), &ok)); if (!ok) return false; - } else if (v.type() != QVariant::Int && v.type() != QVariant::UInt) { + } else if (v.userType() != QMetaType::Int && v.userType() != QMetaType::UInt) { int enumMetaTypeId = QMetaType::type(qualifiedName(menum)); if ((enumMetaTypeId == QMetaType::UnknownType) || (v.userType() != enumMetaTypeId) || !v.constData()) return false; v = QVariant(*reinterpret_cast<const int *>(v.constData())); } - v.convert(QVariant::Int); + v.convert(QMetaType::Int); } else { int handle = priv(mobj->d.data)->propertyData + 3*idx; const char *typeName = nullptr; |