diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-04-17 13:54:20 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-09 00:56:16 +0200 |
commit | c4fab1011b9de42f43a95d598743da505847e139 (patch) | |
tree | 64ca12106f9a624fcd9bd7dee0ceb8928b77895e /src/qml/qml/qqmlpropertycache.cpp | |
parent | 3b04bbde6356797368114fce1b45b85271e9fed8 (diff) |
Remove QQmlData::objectNameChanged callback.
The objectName property now has a proper NOTIFY signal. Also
remove the objectName accessor, as it is no longer required.
Task-number: QTBUG-23526
Change-Id: Ib18ba7335bf62a2fe2a9e489cb4c0f1fb142d74c
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlpropertycache.cpp')
-rw-r--r-- | src/qml/qml/qqmlpropertycache.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 4bfe8aed1f..491629bc0a 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -362,10 +362,7 @@ void QQmlPropertyCache::append(QQmlEngine *engine, const QMetaObject *metaObject QQmlAccessorProperties::Properties accessorProperties; - // Special case QObject as we don't want to add a qt_HasQmlAccessors classinfo to it - if (metaObject == &QObject::staticMetaObject) { - accessorProperties = QQmlAccessorProperties::properties(metaObject); - } else if (classInfoCount) { + if (classInfoCount) { int classInfoOffset = metaObject->classInfoOffset(); bool hasFastProperty = false; for (int ii = 0; ii < classInfoCount; ++ii) { @@ -392,9 +389,12 @@ void QQmlPropertyCache::append(QQmlEngine *engine, const QMetaObject *metaObject } } - // qMax(defaultMethods, methodOffset) to block the signals and slots of QObject::staticMetaObject - // incl. destroyed signals, objectNameChanged signal, deleteLater slot, _q_reregisterTimers slot. - int methodOffset = qMax(QObject::staticMetaObject.methodCount(), metaObject->methodOffset()); + //Used to block access to QObject::destroyed() and QObject::deleteLater() from QML + static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)"); + static const int destroyedIdx2 = QObject::staticMetaObject.indexOfSignal("destroyed()"); + static const int deleteLaterIdx = QObject::staticMetaObject.indexOfSlot("deleteLater()"); + + int methodOffset = metaObject->methodOffset(); int signalOffset = signalCount - QMetaObjectPrivate::get(metaObject)->signalCount; // update() should have reserved enough space in the vector that this doesn't cause a realloc @@ -403,6 +403,8 @@ void QQmlPropertyCache::append(QQmlEngine *engine, const QMetaObject *metaObject signalHandlerIndexCache.resize(signalCount - signalHanderIndexCacheStart); int signalHandlerIndex = signalOffset; for (int ii = methodOffset; ii < methodCount; ++ii) { + if (ii == destroyedIdx1 || ii == destroyedIdx2 || ii == deleteLaterIdx) + continue; QMetaMethod m = metaObject->method(ii); if (m.access() == QMetaMethod::Private) continue; @@ -824,11 +826,15 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, } } + //Used to block access to QObject::destroyed() and QObject::deleteLater() from QML + static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)"); + static const int destroyedIdx2 = QObject::staticMetaObject.indexOfSignal("destroyed()"); + static const int deleteLaterIdx = QObject::staticMetaObject.indexOfSlot("deleteLater()"); + int methodCount = metaObject->methodCount(); - int defaultMethods = QObject::staticMetaObject.methodCount(); - for (int ii = methodCount - 1; ii >= defaultMethods; --ii) { - // >=defaultMethods to block the signals and slots of QObject::staticMetaObject - // incl. destroyed signals, objectNameChanged signal, deleteLater slot, _q_reregisterTimers slot. + for (int ii = methodCount - 1; ii >= 0; --ii) { + if (ii == destroyedIdx1 || ii == destroyedIdx2 || ii == deleteLaterIdx) + continue; QMetaMethod m = metaObject->method(ii); if (m.access() == QMetaMethod::Private) continue; |