Add private API for working with meta-methods in signal index range
authorKent Hansen <kent.hansen@nokia.com>
Wed, 30 May 2012 12:02:55 +0000 (14:02 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 1 Jun 2012 14:04:04 +0000 (16:04 +0200)
commit37db43f1c2515002c4ab4493a954d3e8fdd20363
treee2c95f696978495495fcaf4e37ea454434a04e3d
parent4189d07c837e66f4cda92820477f5fb0e3d9315c
Add private API for working with meta-methods in signal index range

Internally, QObject and QMetaObject already leave out non-signal
methods when working with signals. This is possible because the
signals always come before other types of meta-method in the
meta-object data. Ignoring irrelevant methods is faster and can
save memory.

QMetaObject provides internal indexed-based connect() and
disconnect() functions. However, these functions currently take an
absolute method index as the signal specifier, instead of an
absolute _signal_ index. Hence, QMetaObject and friends must convert
from the method index range to the signal index range.

By providing an API that only considers signal indices, clients of
the index-based QMetaObject::connect()/disconnect() can provide the
proper signal index directly. Similarly, for the qtdeclarative
integration (QDeclarativeData hooks) the signal index can be passed
directly. This will eliminate most of the conversions back and forth
between signal index and method index, and some other redundant work
done by qtdeclarative's custom connection implementation.

There are some places where the behavior can't be changed; for
example,  QObject::senderSignalIndex() will still need to return an
index in the method range, since that function is public API.

Changing QMetaObject::connect()/disconnect() to take an index in
the signal range will be done in a separate commit; this commit is
only an enabler for porting existing usage of those functions to
the new behavior.

Change-Id: Icb475b6bbdccc74b4e7ee5bf72b944b47159cebd
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
src/corelib/kernel/qmetaobject.cpp
src/corelib/kernel/qmetaobject.h
src/corelib/kernel/qmetaobject_p.h
tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro
tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp