Remove QQmlMetaType::isQObject

All callers do have a metatype which they can query instead.

Task-number: QTBUG-82931
Change-Id: I2ff514354a43d677da963d4239333fc66a42df59
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Fabian Kosmale 2021-03-05 11:44:43 +01:00
parent 483d09779c
commit a4ba251179
6 changed files with 5 additions and 14 deletions

View File

@ -196,7 +196,7 @@ QQmlEngineDebugServiceImpl::propertyData(QObject *obj, int propIdx)
rv.value = valueContents(prop.read(obj));
if (QQmlMetaType::isQObject(prop.userType())) {
if (prop.metaType().flags().testFlag(QMetaType::PointerToQObject)) {
rv.type = QQmlObjectProperty::Object;
} else if (QQmlMetaType::isList(prop.userType())) {
rv.type = QQmlObjectProperty::List;
@ -275,7 +275,7 @@ QVariant QQmlEngineDebugServiceImpl::valueContents(QVariant value) const
return value;
}
if (QQmlMetaType::isQObject(metaTypeId)) {
if (metaType.flags().testFlag(QMetaType::PointerToQObject)) {
QObject *o = QQmlMetaType::toQObject(value);
if (o) {
QString name = o->objectName();

View File

@ -1099,14 +1099,6 @@ QObject *QQmlMetaType::toQObject(const QVariant &v, bool *ok)
return *(QObject *const *)v.constData();
}
bool QQmlMetaType::isQObject(int userType)
{
if (userType == QMetaType::QObjectStar)
return true;
QMetaType type (userType);
return type.flags().testFlag(QMetaType::PointerToQObject);
}
/*
Returns the item type for a list of type \a id.
*/

View File

@ -187,7 +187,6 @@ public:
static QMetaMethod defaultMethod(const QMetaObject *);
static QMetaMethod defaultMethod(QObject *);
static bool isQObject(int);
static QObject *toQObject(const QVariant &, bool *ok = nullptr);
static int listType(int);

View File

@ -115,7 +115,7 @@ static void allSubObjects(QObject *object, QObjectList &objectList)
// search recursive in property objects
if (metaProperty.isReadable()
&& metaProperty.isWritable()
&& QQmlMetaType::isQObject(metaProperty.userType())) {
&& metaProperty.metaType().flags().testFlag(QMetaType::PointerToQObject)) {
if (qstrcmp(metaProperty.name(), "parent")) {
QObject *propertyObject = QQmlMetaType::toQObject(metaProperty.read(object));
allSubObjects(propertyObject, objectList);

View File

@ -112,7 +112,7 @@ void QQuickDesignerSupportProperties::keepBindingFromGettingDeleted(QObject *obj
bool QQuickDesignerSupportProperties::isPropertyQObject(const QMetaProperty &metaProperty)
{
return QQmlMetaType::isQObject(metaProperty.userType());
return metaProperty.metaType().flags().testFlag(QMetaType::PointerToQObject);
}

View File

@ -157,7 +157,7 @@ void collectReachableMetaObjects(QObject *object, QSet<const QMetaObject *> *met
for (int index = 0; index < meta->propertyCount(); ++index) {
QMetaProperty prop = meta->property(index);
if (QQmlMetaType::isQObject(prop.userType())) {
if (prop.metaType().flags().testFlag(QMetaType::PointerToQObject)) {
if (verbose)
std::cerr << " Processing property " << qPrintable( prop.name() ) << std::endl;
currentProperty = QString("%1::%2").arg(meta->className(), prop.name());