Qobject_cast and Q_DECLARE_INTERFACE
General and Desktop
3
Posts
2
Posters
2.9k
Views
1
Watching
-
Nearby topic made me think that I don't understand something. qobject_cast documentation says that returned value it undefined if template argument doesn't inherit QObject. But interfaces don't inherit it though Plug & Paint example uses qobject_cast from QObject* to an interface.
Is this an error in the documentation or did I miss something? -
Hi,
that is reason why you use Q_INTERFACES macro, it tells to metaObject that it is "qobject & your inteface" during qobject_cast.. without that macro, you will get null pointer from that cast .. it is in the doc