Using qobject_cast<>() is probably the most straightforward thing to do.