Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.11.3
-
None
-
Debian Buster, gcc gcc (Debian 8.3.0-6) 8.3.0
Description
I have a simple QObject-derived class:
class MyItem : public QObject { Q_OBJECT Q_PROPERTY(QString strfield READ strfield) Q_CLASSINFO("foo", "bar") QString m_strfield; public: explicit MyItem(QObject *parent = nullptr); MyItem(int, int, char *, QString); QString strfield() const \{ return m_strfield; } };
which is registered with `qRegisterMetaType<MyItem*>();`
later, in main.cpp I have the following code:
for (int typeId = QMetaType::User;; typeId++) { if (!QMetaType::isRegistered(typeId)) break; qDebug() << "found metatype" << QMetaType::typeName(typeId); const QMetaObject* mo = QMetaType::metaObjectForType(typeId); qDebug() << "class info"; for (int i = 0; i < mo->classInfoCount(); i++) { qDebug() << "classInfo" << mo->classInfo(i).name() << mo->classInfo(i).value(); } qDebug() << "Constructors" << mo->constructorCount(); for (int ctorIndex = 0; ctorIndex < mo->constructorCount(); ctorIndex++) { QMetaMethod ctor = mo->constructor(ctorIndex); qDebug() << "constructor" << ctor.name() << "signature" << ctor.methodSignature(); } qDebug() << "Methods"; for (int methodIndex = 0; methodIndex < mo->methodCount(); methodIndex++) { QMetaMethod method = mo->method(methodIndex); qDebug() << "method" << method.name() << "signature" << method.methodSignature(); } }
ClassInfo and methods are printed just fine, but constructorCount is always 0;
How come?
Any hints would be appreciated!