I want to create a new instance of class A that inherits a base class derived from QObject.
In case A isn't in a namespace this works fine, but in case A is in a namespace this call returns a null pointer:
QObject *o = metaObject->newInstance(arg1,arg2,arg3);
The metaObject itself returns the correct class name (including the namespace)
std::cout << "Class name from staticMetaObject: " << metaObject->className() << std::endl;
The constructor of A is marked with Q_INVOKABLE. How can I use QMetaObject::newInstance with namespaces?
It definitely works for me under Qt 5.5.1.
Perhaps your base class is missing the
Q_OBJECTmacro.