diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp index a54c24c2b6e..abfb11c8724 100644 --- a/src/corelib/compat/removed_api.cpp +++ b/src/corelib/compat/removed_api.cpp @@ -859,11 +859,6 @@ void QObject::moveToThread(QThread *targetThread) #include "qobjectdefs.h" -int QMetaObject::indexOfEnumerator(const char *name) const -{ - return indexOfEnumerator(QByteArrayView(name)); -} - bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *slot, Qt::ConnectionType type, void *ret) { return invokeMethodImpl(object, slot, type, 1, &ret, nullptr, nullptr); diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index d45673ef25b..e0181041fdf 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1061,16 +1061,17 @@ static const QMetaObject *QMetaObject_findMetaObject(const QMetaObject *self, QB -1. \sa enumerator(), enumeratorCount(), enumeratorOffset() - - \note Starting from Qt 6.7 this method takes a \c QByteArrayView, before - that it took a \c {const char *}. This change is source compatible i.e. - calling this method on a \c {const char *} should still work. */ -int QMetaObject::indexOfEnumerator(QByteArrayView name) const +int QMetaObject::indexOfEnumerator(const char *name) const +{ + return QMetaObjectPrivate::indexOfEnumerator(this, name); +} + +int QMetaObjectPrivate::indexOfEnumerator(const QMetaObject *m, QByteArrayView name) { using W = QMetaObjectPrivate::Which; for (auto which : { W::Name, W::Alias }) { - if (int index = QMetaObjectPrivate::indexOfEnumerator(this, name, which); index != -1) + if (int index = indexOfEnumerator(m, name, which); index != -1) return index; } return -1; @@ -3661,7 +3662,7 @@ QMetaProperty::QMetaProperty(const QMetaObject *mobj, int index) if (!(data.flags() & EnumOrFlag)) return; QByteArrayView enum_name = typeNameFromTypeInfo(mobj, data.type()); - menum = mobj->enumerator(mobj->indexOfEnumerator(enum_name)); + menum = mobj->enumerator(QMetaObjectPrivate::indexOfEnumerator(mobj, enum_name)); if (menum.isValid()) return; @@ -3681,7 +3682,7 @@ QMetaProperty::QMetaProperty(const QMetaObject *mobj, int index) scope = QMetaObject_findMetaObject(mobj, QByteArrayView(scope_name)); if (scope) - menum = scope->enumerator(scope->indexOfEnumerator(enum_name)); + menum = scope->enumerator(QMetaObjectPrivate::indexOfEnumerator(scope, enum_name)); } /*! diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index c3b61212414..d2c36fceb46 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -215,6 +215,7 @@ struct QMetaObjectPrivate enum class Which { Name, Alias }; static int indexOfEnumerator(const QMetaObject *m, QByteArrayView name, Which which); + static int indexOfEnumerator(const QMetaObject *m, QByteArrayView name); Q_CORE_EXPORT static QMetaMethod signal(const QMetaObject *m, int signal_index); static inline int signalOffset(const QMetaObject *m) diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 00da1cc6409..ff06d3762c6 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -262,11 +262,7 @@ struct Q_CORE_EXPORT QMetaObject int indexOfMethod(const char *method) const; int indexOfSignal(const char *signal) const; int indexOfSlot(const char *slot) const; - -#if QT_CORE_REMOVED_SINCE(6, 7) int indexOfEnumerator(const char *name) const; -#endif - int indexOfEnumerator(QByteArrayView name) const; int indexOfProperty(const char *name) const; int indexOfClassInfo(const char *name) const;