summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2022-02-05 22:59:17 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2022-02-09 14:02:57 +0100
commit0477c78a04b8e3cf4ff606561c6538f016576056 (patch)
tree690242bfb0d50fc739948cd20659cc4b85ea48a3
parent0af3d579805006ca1f390bab63fdaad658be69ee (diff)
downloadqtbase-0477c78a04b8e3cf4ff606561c6538f016576056.tar.gz
QMetaProperty: remove property auto-registration code
Qt 6 automatically registers all types used in properties. Thus, the functionality is mostly obsolete since Qt 6. We can simply return the stored metatype's id instead. The code in moc is kept in place for compatibility with older code, though there seem to be no remaining users of the metacall in Qt itself anymore. Change-Id: I3c654150988ae7780b4e9ea1f16191fdadf8d791 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/corelib/kernel/qmetaobject.cpp9
-rw-r--r--src/corelib/kernel/qmetaobject.h3
-rw-r--r--src/tools/moc/generator.cpp1
3 files changed, 9 insertions, 4 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 19c437a4ec..f2aafba008 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -3160,19 +3160,20 @@ bool QMetaProperty::isAlias() const
return (data.flags() & Alias);
}
+#if QT_DEPRECATED_SINCE(6, 4)
/*!
\internal
+ Historically:
Executes metacall with QMetaObject::RegisterPropertyMetaType flag.
Returns id of registered type or QMetaType::UnknownType if a type
could not be registered for any reason.
+ Obsolete since Qt 6
*/
int QMetaProperty::registerPropertyType() const
{
- int registerResult = -1;
- void *argv[] = { &registerResult };
- mobj->static_metacall(QMetaObject::RegisterPropertyMetaType, data.index(mobj), argv);
- return registerResult == -1 ? QMetaType::UnknownType : registerResult;
+ return typeId();
}
+#endif
QMetaProperty::QMetaProperty(const QMetaObject *mobj, int index)
: mobj(mobj),
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index 6fe259868f..228968d37d 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -332,7 +332,10 @@ public:
inline const QMetaObject *enclosingMetaObject() const { return mobj; }
private:
+#if QT_DEPRECATED_SINCE(6, 4)
+ QT_DEPRECATED_VERSION_X_6_4("obsolete, simply returns typeId()")
int registerPropertyType() const;
+#endif
struct Data {
enum { Size = 5 };
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 3e838818f9..3f97544cf2 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -1040,6 +1040,7 @@ void Generator::generateMetacall()
}
+// ### Qt 7 (6.x?): remove
QMultiMap<QByteArray, int> Generator::automaticPropertyMetaTypesHelper()
{
QMultiMap<QByteArray, int> automaticPropertyMetaTypes;