diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-03-05 10:36:19 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-03-05 15:54:50 +0100 |
commit | a7deb047d14170cf16160c748150471456e04af4 (patch) | |
tree | aaf7913b60ffb6f8ba1830d620b8d68641d05741 | |
parent | a9efc8e9dda35c1844c990991cea14a74ddeaf81 (diff) |
Simplify QQmlPropertyData::flagsForProperty; remove typeCategory
We do not need to call QQmlMetaType::typeCategory. The information
whether a type is a QObject or a QML list type is already stored in the
metaobject, and checked in the earlier if branches. Thus, typeCategory
could only ever return Unknown.
As this removes the only real caller of QQmlMetaType::typeCategory, we
can remove the function. QQmlEnginePrivate::typeCategory also called it,
but wasn't called itself (and is now also removed) .
Change-Id: Iea6055ba44de4d71334f40895e7ce85c3230f3d9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 10 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine_p.h | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 20 | ||||
-rw-r--r-- | src/qml/qml/qqmlmetatype_p.h | 4 | ||||
-rw-r--r-- | src/qml/qml/qqmlpropertycache.cpp | 6 |
5 files changed, 0 insertions, 41 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 26dc0730f9..d8c860bd24 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -2053,16 +2053,6 @@ bool QQmlEnginePrivate::isQObject(int t) return m_compositeTypes.contains(t) || QQmlMetaType::isQObject(t); } - -QQmlMetaType::TypeCategory QQmlEnginePrivate::typeCategory(int t) const -{ - Locker locker(this); - if (m_compositeTypes.contains(t)) - return QQmlMetaType::Object; - return QQmlMetaType::typeCategory(t); -} - - static QQmlPropertyCache *propertyCacheForPotentialInlineComponentType(int t, const QHash<int, QV4::ExecutableCompilationUnit *>::const_iterator &iter) { if (t != (*iter)->typeIds.id.id()) { // this is an inline component, and what we have in the iterator is currently the parent compilation unit diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h index 1ea5f3bedc..d085d30887 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -236,7 +236,6 @@ public: // These methods may be called from the loader thread bool isQObject(int); - QQmlMetaType::TypeCategory typeCategory(int) const; QQmlMetaObject rawMetaObjectForType(int) const; QQmlMetaObject metaObjectForType(int) const; QQmlPropertyCache *propertyCacheForType(int); diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 7ce57c8d9f..8369634889 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -1184,26 +1184,6 @@ QMetaMethod QQmlMetaType::defaultMethod(QObject *obj) return defaultMethod(metaObject); } -QQmlMetaType::TypeCategory QQmlMetaType::typeCategory(int userType) -{ - if (userType < 0) - return Unknown; - if (userType == QMetaType::QObjectStar) - return Object; - - QMetaType type(userType); - if (type.flags().testFlag(QMetaType::PointerToQObject)) - return Object; - else if (type.flags().testFlag(QMetaType::IsQmlList)) - return List; - - QQmlMetaTypeDataPtr data; - if (data->qmlLists.contains(userType)) - return List; - else - return Unknown; -} - /*! See qmlRegisterInterface() for information about when this will return true. */ diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h index 0cfe313421..e0b43c6c52 100644 --- a/src/qml/qml/qqmlmetatype_p.h +++ b/src/qml/qml/qqmlmetatype_p.h @@ -193,10 +193,6 @@ public: static int listType(int); static QQmlAttachedPropertiesFunc attachedPropertiesFunc(QQmlEnginePrivate *, const QMetaObject *); - - enum TypeCategory { Unknown, Object, List }; - static TypeCategory typeCategory(int); - static bool isInterface(int); static const char *interfaceIId(int); static bool isList(int); diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 4fdd7ea79b..f2f6b975eb 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -102,12 +102,6 @@ QQmlPropertyData::flagsForProperty(const QMetaProperty &p) flags.type = QQmlPropertyData::Flags::QJSValueType; } else if (metaType.flags() & QMetaType::IsQmlList) { flags.type = QQmlPropertyData::Flags::QListType; - } else { - QQmlMetaType::TypeCategory cat = QQmlMetaType::typeCategory(propType); - if (cat == QQmlMetaType::Object) - flags.type = QQmlPropertyData::Flags::QObjectDerivedType; - else if (cat == QQmlMetaType::List) - flags.type = QQmlPropertyData::Flags::QListType; } return flags; |