From 79f675a1e0f628bbc25345ebc1eb1f5809166c6b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 11 Nov 2011 17:01:06 +0100 Subject: Change the return value of QObject::connect From a bool to a handle to to connection. Also added a new overload of disconnect that disconnect a handle This is required because with the new syntax taking lambda or functors, it is the only way to disconnect a connection (as it is impossible to compare functors) The new return value is QMetaObject::Connection, it is a wrapper around the internal QObjectPrivate::Connection. QObjectPrivate::Connection is now reference counted. tst_qglobal.cpp: This test set up an internal callback, and the callback do not set any proper connection handle (and tbh, it would be hard for it to do so). So the returned QMetaObject::Connection is invalid, and ok is false (Internal callbacks are only used for jambi and should probably be removed) Change-Id: I111626fb4f47efc4db5e2ea5bff9da15f08fea7b Reviewed-by: Bradley T. Hughes Reviewed-by: Thiago Macieira --- src/corelib/kernel/qmetaobject_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/kernel/qmetaobject_p.h') diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index 919273a605..0476558a92 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -137,7 +137,7 @@ struct QMetaObjectPrivate enum DisconnectType { DisconnectAll, DisconnectOne }; static void memberIndexes(const QObject *obj, const QMetaMethod &member, int *signalIndex, int *methodIndex); - static bool connect(const QObject *sender, int signal_index, + static QObjectPrivate::Connection *connect(const QObject *sender, int signal_index, const QObject *receiver, int method_index_relative, const QMetaObject *rmeta = 0, int type = 0, int *types = 0); -- cgit v1.2.3