doc: Fix QObject::connect documentation

Unfortunately, qdoc is too simple to understand any pointer to member
function syntax.
(the ::* token is not even tokenized. And even if it was, it would be a
difficult way to hack that into the parser. (there is already an ugly
workaround for non-member pointer to function hat works by having '(*'
as a token,but the same hack is not possible for pointer to member function))
So I just put verbatim 'PointerToMemberFunction'

Also remove the obsolete mention that Qt::UniqueConnection is not supported
in that overload. It is now. (And it even contradicts the previous
paragraph)

Change-Id: I8fc9544808c9a462b0f11ccea406e2e33dee15b1
Reviewed-by: Geir Vattekar <geir.vattekar@nokia.com>
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
This commit is contained in:
Olivier Goffart 2012-04-12 22:46:01 +02:00 committed by Qt by Nokia
parent 84caba25d8
commit 5a8c13a7d4
3 changed files with 12 additions and 15 deletions

View File

@ -3872,8 +3872,8 @@ void qDeleteInEventHandler(QObject *o)
} }
/*! /*!
\fn QMetaObject::Connection QObject::connect(const QObject *sender, (T::*signal)(...), const QObject *receiver, (T::*method)(...), Qt::ConnectionType type) \fn QMetaObject::Connection QObject::connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
\overload connect()
\threadsafe \threadsafe
Creates a connection of the given \a type from the \a signal in Creates a connection of the given \a type from the \a signal in
@ -3929,18 +3929,14 @@ void qDeleteInEventHandler(QObject *o)
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 25 \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 25
make sure to declare the argument type with Q_DECLARE_METATYPE make sure to declare the argument type with Q_DECLARE_METATYPE
A signal is emitted for every connection you make;
two signals are emitted for duplicate connections.
This overload does not support the type Qt::UniqueConnection
*/ */
/*! /*!
\fn QMetaObject::Connection QObject::connect(const QObject *sender, (T::*signal)(...), Functor functor) \fn QMetaObject::Connection QObject::connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
\threadsafe \threadsafe
\overload \overload connect()
Creates a connection of the given \a type from the \a signal in Creates a connection of the given \a type from the \a signal in
the \a sender object to the \a functor and returns a handle to the connection the \a sender object to the \a functor and returns a handle to the connection
@ -4089,9 +4085,9 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
return true; return true;
} }
/*! \fn bool QObject::disconnect(const QObject *sender, (T::*signal)(...), const Qbject *receiver, (T::*method)(...)) /*! \fn bool QObject::disconnect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
\overload diconnect()
\threadsafe \threadsafe
\overload
Disconnects \a signal in object \a sender from \a method in object Disconnects \a signal in object \a sender from \a method in object
\a receiver. Returns true if the connection is successfully broken; \a receiver. Returns true if the connection is successfully broken;
@ -4148,6 +4144,7 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
\sa connect() \sa connect()
*/ */
bool QObject::disconnectImpl(const QObject *sender, void **signal, const QObject *receiver, void **slot, const QMetaObject *senderMetaObject) bool QObject::disconnectImpl(const QObject *sender, void **signal, const QObject *receiver, void **slot, const QMetaObject *senderMetaObject)
{ {
if (sender == 0 || (receiver == 0 && slot != 0)) { if (sender == 0 || (receiver == 0 && slot != 0)) {
@ -4209,7 +4206,7 @@ QMetaObject::Connection::~Connection()
} }
/*! /*!
\fn bool QMetaObject::Connection::operator bool() \fn QMetaObject::Connection::operator bool() const
Returns true if the connection is valid. Returns true if the connection is valid.

View File

@ -199,8 +199,8 @@ public:
const char *member, Qt::ConnectionType type = Qt::AutoConnection) const; const char *member, Qt::ConnectionType type = Qt::AutoConnection) const;
#ifdef Q_QDOC #ifdef Q_QDOC
QMetaObject::Connection QObject::connect(const QObject *sender, (T::*signal)(...), const QObject *receiver, (T::*method)(...), Qt::ConnectionType type) static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type);
QMetaObject::Connection QObject::connect(const QObject *sender, (T::*signal)(...), Functor functor) static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor);
#else #else
//Connect a signal to a pointer to qobject member function //Connect a signal to a pointer to qobject member function
template <typename Func1, typename Func2> template <typename Func1, typename Func2>
@ -279,7 +279,7 @@ public:
static bool disconnect(const QMetaObject::Connection &); static bool disconnect(const QMetaObject::Connection &);
#ifdef Q_QDOC #ifdef Q_QDOC
bool QObject::disconnect(const QObject *sender, (T::*signal)(...), const Qbject *receiver, (T::*method)(...)) static bool disconnect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method);
#else #else
template <typename Func1, typename Func2> template <typename Func1, typename Func2>
static inline bool disconnect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, static inline bool disconnect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,

View File

@ -462,7 +462,7 @@ public:
Connection(); Connection();
Connection(const Connection &other); Connection(const Connection &other);
Connection &operator=(const Connection &other); Connection &operator=(const Connection &other);
#ifdef qdoc #ifdef Q_QDOC
operator bool() const; operator bool() const;
#else #else
typedef void *Connection::*RestrictedBool; typedef void *Connection::*RestrictedBool;