diff options
-rw-r--r-- | src/qml/qml/qqmlmetaobject.cpp | 22 | ||||
-rw-r--r-- | src/qml/qml/qqmlmetaobject_p.h | 6 |
2 files changed, 5 insertions, 23 deletions
diff --git a/src/qml/qml/qqmlmetaobject.cpp b/src/qml/qml/qqmlmetaobject.cpp index e84c5a366e..d5f1fb3b96 100644 --- a/src/qml/qml/qqmlmetaobject.cpp +++ b/src/qml/qml/qqmlmetaobject.cpp @@ -8,28 +8,6 @@ QT_BEGIN_NAMESPACE -// Returns true if \a from is assignable to a property of type \a to -bool QQmlMetaObject::canConvert(const QQmlMetaObject &from, const QQmlMetaObject &to) -{ - Q_ASSERT(!from.isNull() && !to.isNull()); - - auto equal = [] (const QMetaObject *lhs, const QMetaObject *rhs) -> bool { - return lhs == rhs || (lhs && rhs && lhs->d.stringdata == rhs->d.stringdata); - }; - - const QMetaObject *tom = to.metaObject(); - if (tom == &QObject::staticMetaObject) return true; - - const QMetaObject *fromm = from.metaObject(); - while (fromm) { - if (equal(fromm, tom)) - return true; - fromm = fromm->superClass(); - } - - return false; -} - void QQmlMetaObject::resolveGadgetMethodOrPropertyIndex(QMetaObject::Call type, const QMetaObject **metaObject, int *index) { int offset; diff --git a/src/qml/qml/qqmlmetaobject_p.h b/src/qml/qml/qqmlmetaobject_p.h index cc3cc6af79..288779c74c 100644 --- a/src/qml/qml/qqmlmetaobject_p.h +++ b/src/qml/qml/qqmlmetaobject_p.h @@ -67,7 +67,11 @@ public: bool constructorParameterTypes(int index, ArgTypeStorage *dummy, QByteArray *unknownTypeError) const; - static bool canConvert(const QQmlMetaObject &from, const QQmlMetaObject &to); + static bool canConvert(const QQmlMetaObject &from, const QQmlMetaObject &to) + { + Q_ASSERT(!from.isNull() && !to.isNull()); + return from.metaObject()->inherits(to.metaObject()); + } // static_metacall (on Gadgets) doesn't call the base implementation and therefore // we need a helper to find the correct meta object and property/method index. |