[Qt-interest] QMetaObject doesn't know about methods on QObject
Stephen Kelly
steveire at gmail.com
Fri Jan 9 12:28:31 CET 2009
Hi,
Consider this:
QObject *obj= new QObject();
const QMetaObject *mObj = obj->metaObject();
for (int i = 0; i < mObj->methodCount(); ++i)
{
QMetaMethod mm = mObj->method(i);
qDebug() << (mm.methodType() == QMetaMethod::Signal) << (mm.methodType() == QMetaMethod::Slot) << (mm.methodType() == QMetaMethod::Method) << mm.signature() << mm.parameterNames() << mm.parameterTypes();
}
I expect it to output a line for each method in QObject, but it actually only prints signals and slots despite the docs of QMetaObject implying otherwise: http://doc.trolltech.com/4.4/qmetaobject.html#methodCount
> These include signals and slots as well as normal member functions
I also can't seem to iterate over the enums in a class when introspecting QThread.
Anyone know what's going on here? Am I missing something important?
All the best,
Steve.
More information about the Qt-interest-old
mailing list