diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2012-08-23 11:37:45 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-23 15:54:02 +0200 |
commit | 022e3a358dcc6815d28a5103eb6562d4dc045a7c (patch) | |
tree | 97b59056f4f74ba9bc22ae789eefefe32ad6783e /src | |
parent | 62565321a6aebb58bc41613e38ad8ebaa08f23fe (diff) |
Extract the QMetaMethodPrivate::ownMethodIndex method.
Change-Id: Ic96e3582ff4332ac489f7c51ed40eb1b1a0ac42d
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qmetaobject.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 1024981d3b..e76efc35da 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -209,6 +209,7 @@ public: inline QList<QByteArray> parameterTypes() const; inline QList<QByteArray> parameterNames() const; inline QByteArray tag() const; + inline int ownMethodIndex() const; private: QMetaMethodPrivate(); @@ -851,7 +852,7 @@ int QMetaObjectPrivate::signalIndex(const QMetaMethod &m) { if (!m.mobj) return -1; - return ((m.handle - priv(m.mobj->d.data)->methodData) / 5) + signalOffset(m.mobj); + return QMetaMethodPrivate::get(&m)->ownMethodIndex() + signalOffset(m.mobj); } /*! @@ -1695,6 +1696,12 @@ QByteArray QMetaMethodPrivate::tag() const return stringData(mobj, mobj->d.data[handle + 3]); } +int QMetaMethodPrivate::ownMethodIndex() const +{ + // recompute the methodIndex by reversing the arithmetic in QMetaObject::property() + return (handle - priv(mobj->d.data)->methodData) / 5; +} + /*! \since 5.0 @@ -1885,7 +1892,7 @@ int QMetaMethod::methodIndex() const { if (!mobj) return -1; - return ((handle - priv(mobj->d.data)->methodData) / 5) + mobj->methodOffset(); + return QMetaMethodPrivate::get(this)->ownMethodIndex() + mobj->methodOffset(); } /*! @@ -1901,7 +1908,7 @@ int QMetaMethod::revision() const if ((QMetaMethod::Access)(mobj->d.data[handle + 4] & MethodRevisioned)) { int offset = priv(mobj->d.data)->methodData + priv(mobj->d.data)->methodCount * 5 - + (handle - priv(mobj->d.data)->methodData) / 5; + + QMetaMethodPrivate::get(this)->ownMethodIndex(); return mobj->d.data[offset]; } return 0; @@ -2120,8 +2127,7 @@ bool QMetaMethod::invoke(QObject *object, val8.data(), val9.data() }; - // recompute the methodIndex by reversing the arithmetic in QMetaObject::property() - int idx_relative = ((handle - priv(mobj->d.data)->methodData) / 5); + int idx_relative = QMetaMethodPrivate::get(this)->ownMethodIndex(); int idx_offset = mobj->methodOffset(); Q_ASSERT(QMetaObjectPrivate::get(mobj)->revision >= 6); QObjectPrivate::StaticMetaCallFunction callFunction = mobj->d.static_metacall; |