[Qt-interest] getting inside the moc

Luca Ferrari fluca1978 at infinito.it
Wed May 13 12:39:55 CEST 2009


I'm trying to "spy" what moc and qt do, but I'm having a doubt. In the moc 
generated file I've got that the QMetaObject struct is initialized as follows:

const QMetaObject Signal::staticMetaObject = {
    { &QObject::staticMetaObject, qt_meta_stringdata_Signal,
      qt_meta_data_Signal, 0 }
};

having qt_meta_stringdata_Signal being:

static const char qt_meta_stringdata_Signal[] = {
    "Signal\0\0emittingValue\0integerSignal(int)\0"
    "voidSignal()\0emittingFloatValue\0"
    "floatSignal(float)\0"
};

However, if I try to do the following:

const QMetaObject* metaObject = this->metaObject();
const char* stringdata = metaObject->d.stringdata;

the stringdata I'm getting is null. On the other hand, the same applied to the 
d.data works fine. Why?

Thanks,
Luca



More information about the Qt-interest-old mailing list