File indexing completed on 2024-04-28 05:38:41
0001 #include <QtCore/QObject> 0002 0003 class MyObject_hasEventFilter : public QObject 0004 { 0005 protected: 0006 bool eventFilter(QObject *, QEvent *) override; 0007 }; 0008 0009 class MyObject_doesntHaveEventFilter : public QObject 0010 { 0011 }; 0012 0013 class Obj : public QObject 0014 { 0015 public: 0016 Obj(MyObject_hasEventFilter* other) 0017 { 0018 other->installEventFilter(this); // OK 0019 other->installEventFilter(other); // OK 0020 installEventFilter(other); // OK 0021 installEventFilter(this); // Warning 0022 this->installEventFilter(other); // OK 0023 } 0024 0025 void test2(MyObject_doesntHaveEventFilter *other) 0026 { 0027 other->installEventFilter(this); // OK 0028 other->installEventFilter(other); // OK 0029 installEventFilter(this); // Warning 0030 this->installEventFilter(other); // Warning 0031 installEventFilter(other); // Warning 0032 } 0033 }; 0034 0035 class DerivedDerived : public Obj {}; 0036 class DerivedDerived2 : public MyObject_hasEventFilter {}; 0037 0038 class TestBiggerHierarchy : public QObject 0039 { 0040 void test(DerivedDerived *d1, DerivedDerived2 *d2) 0041 { 0042 installEventFilter(d1); // Warning 0043 installEventFilter(d2); // OK 0044 } 0045 };