Warning, file /sdk/clazy/tests/child-event-qobject-cast/main.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #include <QtCore/QCoreApplication> 0002 #include <QtCore/QObject> 0003 0004 static QObject *s_obj; 0005 extern QObject *getObject(); 0006 0007 class A : public QObject 0008 { 0009 public: 0010 void childEvent(QChildEvent *ev) 0011 { 0012 auto obj1 = qobject_cast<QCoreApplication*>(ev->child()); // Warning 0013 auto obj2 = qobject_cast<QCoreApplication*>(s_obj); // OK 0014 auto obj3 = qobject_cast<QCoreApplication*>(getObject()); // OK 0015 } 0016 }; 0017