summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetaobject_p.h
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-05-30 14:02:55 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-01 16:04:04 +0200
commit37db43f1c2515002c4ab4493a954d3e8fdd20363 (patch)
treee2c95f696978495495fcaf4e37ea454434a04e3d /src/corelib/kernel/qmetaobject_p.h
parent4189d07c837e66f4cda92820477f5fb0e3d9315c (diff)
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>
Diffstat (limited to 'src/corelib/kernel/qmetaobject_p.h')
-rw-r--r--src/corelib/kernel/qmetaobject_p.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h
index 320b8dd9d7..855a0e04e7 100644
--- a/src/corelib/kernel/qmetaobject_p.h
+++ b/src/corelib/kernel/qmetaobject_p.h
@@ -203,7 +203,10 @@ struct QMetaObjectPrivate
int argc, const QArgumentType *types);
static int indexOfConstructor(const QMetaObject *m, const QByteArray &name,
int argc, const QArgumentType *types);
- static QMetaMethod signal(const QMetaObject *m, int signal_index);
+ Q_CORE_EXPORT static QMetaMethod signal(const QMetaObject *m, int signal_index);
+ Q_CORE_EXPORT static int signalOffset(const QMetaObject *m);
+ Q_CORE_EXPORT static int absoluteSignalCount(const QMetaObject *m);
+ Q_CORE_EXPORT static int signalIndex(const QMetaMethod &m);
static bool checkConnectArgs(int signalArgc, const QArgumentType *signalTypes,
int methodArgc, const QArgumentType *methodTypes);
static bool checkConnectArgs(const QMetaMethodPrivate *signal,