summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qvariant.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-07-27 17:00:22 +0200
committerLars Knoll <lars.knoll@qt.io>2020-08-24 00:19:18 +0200
commite7e7540aecc5a4a44f1d1a25e58ccbcf662cbe24 (patch)
treefa54df19419fb304b14000d0c6fa69b6ad883def /src/corelib/kernel/qvariant.h
parent92a31781bb17d31ab09291ca00efb4346cb2f371 (diff)
Deprecate int based convert/canConvert
Better to provide the correct meta type to convert to. Change-Id: I8e0d46e4ba482186201c157e302c03874bd38e7b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qvariant.h')
-rw-r--r--src/corelib/kernel/qvariant.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 9ce12ad1b2..48ea3a9a03 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -249,8 +249,18 @@ class Q_CORE_EXPORT QVariant
const char *typeName() const;
QMetaType metaType() const;
- bool canConvert(int targetTypeId) const;
- bool convert(int targetTypeId);
+ bool canConvert(QMetaType targetType) const
+ { return QMetaType::canConvert(d.type(), targetType); }
+ bool convert(QMetaType type);
+
+#if QT_DEPRECATED_SINCE(6, 0)
+ QT_DEPRECATED_VERSION_6_0
+ bool canConvert(int targetTypeId) const
+ { return QMetaType::canConvert(d.type(), QMetaType(targetTypeId)); }
+ QT_DEPRECATED_VERSION_6_0
+ bool convert(int targetTypeId)
+ { return convert(QMetaType(targetTypeId)); }
+#endif
inline bool isValid() const;
bool isNull() const;
@@ -376,7 +386,7 @@ class Q_CORE_EXPORT QVariant
template<typename T>
bool canConvert() const
- { return canConvert(qMetaTypeId<T>()); }
+ { return canConvert(QMetaType::fromType<T>()); }
public:
struct PrivateShared