[Qt-interest] How can I know A is derived from B in QT
Alessandro Portale
Alessandro.Portale at trolltech.com
Sat Sep 19 15:02:49 CEST 2009
yi xia schrieb:
> Hi ALL,
> Is there any method to tell me whether A is derived from B?
>
> I use dynamic_cast, but on my buggy arm board, this method will cause
> the board to hang.
If 'A' is derived from QObject, you might give qobject_cast a try:
http://doc.qt.nokia.com/latest/qobject.html#qobject_cast
If that does also not work, there is still QObject::inherits():
http://doc.qt.nokia.com/latest/qobject.html#inherits
Alessandro
More information about the Qt-interest-old
mailing list