diff options
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 149 |
1 files changed, 27 insertions, 122 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 23e4e1163c..efa71470d4 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 <qregexp.h> #if QT_CONFIG(regularexpression) # include <qregularexpression.h> #endif @@ -164,7 +163,6 @@ extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *) #endif void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = nullptr; -void (*QAbstractDeclarativeData::destroyed_qml1)(QAbstractDeclarativeData *, QObject *) = nullptr; void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = nullptr; void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = nullptr; int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = nullptr; @@ -229,10 +227,6 @@ QObjectPrivate::~QObjectPrivate() if (metaObject) metaObject->objectDestroyed(q_ptr); -#ifndef QT_NO_USERDATA - if (extraData) - qDeleteAll(extraData->userData); -#endif delete extraData; } @@ -992,15 +986,8 @@ QObject::~QObject() emit destroyed(this); } - if (d->declarativeData) { - if (static_cast<QAbstractDeclarativeDataImpl*>(d->declarativeData)->ownedByQml1) { - if (QAbstractDeclarativeData::destroyed_qml1) - QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this); - } else { - if (QAbstractDeclarativeData::destroyed) - QAbstractDeclarativeData::destroyed(d->declarativeData, this); - } - } + if (d->declarativeData && QAbstractDeclarativeData::destroyed) + QAbstractDeclarativeData::destroyed(d->declarativeData, this); QObjectPrivate::ConnectionData *cd = d->connections.loadRelaxed(); if (cd) { @@ -1913,20 +1900,6 @@ void QObject::killTimer(int id) */ /*! - \fn template<typename T> QList<T> 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<T> QObject::findChildren(const QRegularExpression &re, Qt::FindChildOptions options) const \overload findChildren() @@ -1972,21 +1945,6 @@ void QObject::killTimer(int id) */ /*! - \fn template<typename T> QList<T> qFindChildren(const QObject *obj, const QRegExp ®Exp) - \relates QObject - \overload qFindChildren() - - This function is equivalent to - \a{obj}->\l{QObject::findChildren()}{findChildren}<T>(\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 */ void qt_qFindChildren_helper(const QObject *parent, const QString &name, @@ -2007,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<void*> *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 @@ -4277,58 +4212,6 @@ void QObject::dumpObjectInfo() const } } -#ifndef QT_NO_USERDATA -static QBasicAtomicInteger<uint> user_data_registration = Q_BASIC_ATOMIC_INITIALIZER(0); - -/*! - \internal - */ -uint QObject::registerUserData() -{ - return user_data_registration.fetchAndAddRelaxed(1); -} - -/*! - \fn QObjectUserData::QObjectUserData() - \internal - */ - -/*! - \internal - */ -QObjectUserData::~QObjectUserData() -{ -} - -/*! - \internal - */ -void QObject::setUserData(uint id, QObjectUserData* data) -{ - Q_D(QObject); - if (!d->extraData) - d->extraData = new QObjectPrivate::ExtraData; - - if (d->extraData->userData.size() <= (int) id) - d->extraData->userData.resize((int) id + 1); - d->extraData->userData[id] = data; -} - -/*! - \internal - */ -QObjectUserData* QObject::userData(uint id) const -{ - Q_D(const QObject); - if (!d->extraData) - return nullptr; - if ((int)id < d->extraData->userData.size()) - return d->extraData->userData.at(id); - return nullptr; -} - -#endif // QT_NO_USERDATA - #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QObject *o) @@ -4634,6 +4517,23 @@ QDebug operator<<(QDebug dbg, const QObject *o) */ /*! + \macro Q_MOC_INCLUDE + \relates QObject + \since 6.0 + + The Q_MOC_INCLUDE macro can be used within or outside a class, and tell the + \l{moc}{Meta Object Compiler} to add an include. + + \code + // Put this in your code and the generated code will include this header. + Q_MOC_INCLUDE("myheader.h") + \endcode + + This is useful if the types you use as properties or signal/slots arguments + are forward declared. +*/ + +/*! \macro Q_SIGNALS \relates QObject @@ -4748,10 +4648,15 @@ QDebug operator<<(QDebug dbg, const QObject *o) Using the same Window class as the previous example, the newProperty and newMethod would only be exposed in this code when the expected version is - 1 or greater. + \c{2.1} or greater. + + Since all methods are considered to be in revision \c{0} if untagged, a tag + of \c{Q_REVISION(0)} or \c{Q_REVISION(0, 0)} is invalid and ignored. - Since all methods are considered to be in revision 0 if untagged, a tag - of Q_REVISION(0) is invalid and ignored. + You can pass one or two integer parameters to \c{Q_REVISION}. If you pass + one parameter, it denotes the minor version only. This means that the major + version is unspecified. If you pass two, the first parameter is the major + version and the second parameter is the minor version. This tag is not used by the meta-object system itself. Currently this is only used by the QtQml module. |