blob: afb4d1c391d1baef1b1850173fab0858b968d6d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#include <QtCore/QObject>
class MyObject_hasEventFilter : public QObject
{
protected:
bool eventFilter(QObject *, QEvent *) override;
};
class MyObject_doesntHaveEventFilter : public QObject
{
};
class Obj : public QObject
{
public:
Obj(MyObject_hasEventFilter* other)
{
other->installEventFilter(this); // OK
other->installEventFilter(other); // OK
installEventFilter(other); // OK
installEventFilter(this); // Warning
this->installEventFilter(other); // OK
}
void test2(MyObject_doesntHaveEventFilter *other)
{
other->installEventFilter(this); // OK
other->installEventFilter(other); // OK
installEventFilter(this); // Warning
this->installEventFilter(other); // Warning
installEventFilter(other); // Warning
}
};
class DerivedDerived : public Obj {};
class DerivedDerived2 : public MyObject_hasEventFilter {};
class TestBiggerHierarchy : public QObject
{
void test(DerivedDerived *d1, DerivedDerived2 *d2)
{
installEventFilter(d1); // Warning
installEventFilter(d2); // OK
}
};
|