[quote author="ddriver" date="1330097642"]Yes, this is the generic way to go, I was just curious if Qt provides some improvement as it does in many other areas.
I suppose it is possible to extend stock Qt classes with additional member variable to identify a set of pre-defined objects during runtime instead of casting one by one. Then a simple switch should be way faster than a chain of dynamic casts.[/quote]
Well, you won't win anything ;-)
You always can identify QObject classes during runtime using QObject::metaObject()->className(), but in order to use it you will have to cast to it.
Each class has its unique interface (set of methods, members and properties) and in order to access this interface (invoke a method) you will have to use either a pointer of the class' type or the parent class' type, because C++ enforces strict typing. And this type has to be known at compile time.
So in order to distinct n different classes you will have in any case to cast n times.
If multiple object share the same interface they share the same base class, so they can be called through a base class pointer, to which you have to cast too.
Qt doesn't improve anything here because there is just nothing to improve. That's how C++ and any other non-interpreted language works ;-)