From dd152c84045f56367a98c11261d5c00f4398045a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 2 Apr 2020 14:47:25 +0200 Subject: Remove QRegExp based functionality from QObject QRegExp is going away for Qt6. Change-Id: I04d6331379dc769394b160d976eb9f21fe649a22 Reviewed-by: Alex Blasche --- src/corelib/kernel/qobject.cpp | 53 ------------------------------------------ src/corelib/kernel/qobject.h | 28 ---------------------- 2 files changed, 81 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 2fdf94c38b..4cb0133e2f 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -50,7 +50,6 @@ #include "qloggingcategory.h" #include "qvariant.h" #include "qmetaobject.h" -#include #if QT_CONFIG(regularexpression) # include #endif @@ -1900,20 +1899,6 @@ void QObject::killTimer(int id) \sa findChild() */ -/*! - \fn template QList QObject::findChildren(const QRegExp ®Exp, Qt::FindChildOptions options) const - \overload findChildren() - \obsolete - - Returns the children of this object that can be cast to type T - and that have names matching the regular expression \a regExp, - or an empty list if there are no such objects. - The search is performed recursively, unless \a options specifies the - option FindDirectChildrenOnly. - - Use the findChildren overload taking a QRegularExpression instead. -*/ - /*! \fn QList QObject::findChildren(const QRegularExpression &re, Qt::FindChildOptions options) const \overload findChildren() @@ -1959,21 +1944,6 @@ void QObject::killTimer(int id) \sa QObject::findChildren() */ -/*! - \fn template QList qFindChildren(const QObject *obj, const QRegExp ®Exp) - \relates QObject - \overload qFindChildren() - - This function is equivalent to - \a{obj}->\l{QObject::findChildren()}{findChildren}(\a regExp). - - \note This function was provided as a workaround for MSVC 6 - which did not support member template functions. It is advised - to use the other form in new code. - - \sa QObject::findChildren() -*/ - /*! \internal */ @@ -1995,29 +1965,6 @@ void qt_qFindChildren_helper(const QObject *parent, const QString &name, } } -#ifndef QT_NO_REGEXP -/*! - \internal -*/ -void qt_qFindChildren_helper(const QObject *parent, const QRegExp &re, - const QMetaObject &mo, QList *list, Qt::FindChildOptions options) -{ - if (!parent || !list) - return; - const QObjectList &children = parent->children(); - QRegExp reCopy = re; - QObject *obj; - for (int i = 0; i < children.size(); ++i) { - obj = children.at(i); - if (mo.cast(obj) && reCopy.indexIn(obj->objectName()) != -1) - list->append(obj); - - if (options & Qt::FindChildrenRecursively) - qt_qFindChildren_helper(obj, re, mo, list, options); - } -} -#endif // QT_NO_REGEXP - #if QT_CONFIG(regularexpression) /*! \internal diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 8d9cc3ab83..556d975786 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -72,9 +72,6 @@ class QObject; class QThread; class QWidget; class QAccessibleWidget; -#ifndef QT_NO_REGEXP -class QRegExp; -#endif #if QT_CONFIG(regularexpression) class QRegularExpression; #endif @@ -84,8 +81,6 @@ typedef QList QObjectList; Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QMetaObject &mo, QList *list, Qt::FindChildOptions options); -Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QRegExp &re, - const QMetaObject &mo, QList *list, Qt::FindChildOptions options); Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re, const QMetaObject &mo, QList *list, Qt::FindChildOptions options); Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options); @@ -180,21 +175,6 @@ public: return list; } -#ifndef QT_NO_REGEXP -#if QT_DEPRECATED_SINCE(5, 13) - template - QT_DEPRECATED_X("Use findChildren(const QRegularExpression &, ...) instead.") - inline QList findChildren(const QRegExp &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const - { - typedef typename std::remove_cv::type>::type ObjType; - QList list; - qt_qFindChildren_helper(this, re, ObjType::staticMetaObject, - reinterpret_cast *>(&list), options); - return list; - } -#endif -#endif - #if QT_CONFIG(regularexpression) template inline QList findChildren(const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const @@ -475,14 +455,6 @@ inline QT_DEPRECATED QList qFindChildren(const QObject *o, const QString &nam return o->findChildren(name); } -#if !defined(QT_NO_REGEXP) || defined(Q_CLANG_QDOC) -template -inline QT_DEPRECATED QList qFindChildren(const QObject *o, const QRegExp &re) -{ - return o->findChildren(re); -} -#endif - #endif //QT_DEPRECATED template -- cgit v1.2.3