Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, April 2007
understanding dumpObjectInfo()


Message 1 in thread

Can anyone throw some light on the output format of
QObject::dumpObjectInfo() ?

If I call it from within a class called NSocket, I get the following:

OBJECT NSocket::unnamed

I'm not sure what the "unnamed" bit is.. or OBJECT.. any ideas? Is there
an easier way to see the signal / slot connections for a particular
class? I saw QMetaObject, but that seems to do the reverse of what I
want (useful when you already know that a slot / signal exists).


Thanks,

-- 
 [ signature omitted ] 

Message 2 in thread

Hi,

> Can anyone throw some light on the output format of
> QObject::dumpObjectInfo() ?

Since this doesn't seem to be documented, have a look at the source code 
in src/corelib/kernel/qobject.cpp.

> If I call it from within a class called NSocket, I get the following:
> 
> OBJECT NSocket::unnamed

OBJECT starts the line describing the object itself. Here "NSocket" is 
the class name while "unnamed" is the name of the instance of the class, 
as set by QObject::setObjectName().

Then there are lines starting with "SIGNALS IN" for connections where 
the object is the receiver and "SIGNALS OUT" for connections where the 
object is the sender.

> I'm not sure what the "unnamed" bit is.. or OBJECT.. any ideas? Is there
> an easier way to see the signal / slot connections for a particular
> class? I saw QMetaObject, but that seems to do the reverse of what I
> want (useful when you already know that a slot / signal exists).

What do you need exactly? A list of signals and slots associated to a 
class? A list of effective connections associated to an instance of a class?

QMetaObject describes a class. You can retrieve a list of signals and 
slots associated to the class, whether they are used in instances of the 
class or not.

QObject::dumpObjectInfo() describes an instance of a class. It will dump 
information about effective connections with other objects and it will 
not show signals and slots that are not connected.

--
 [ signature omitted ]