I'm looking for something like this:

MyClass::metaObject()->className()

which doesn't work because at the point where this code is executed, there exists no instantiation of MyClass.

If this is somehow possible, is there a way of getting all names of the classes that have been derived from MyClass?

2

There are 2 best solutions below

2
On BEST ANSWER

Use the static meta object:

 MyClass::staticMetaObject.className()

Works!

1
On

You should be able to use:

obj->metaObject()->className();