Debian Codegraph @

tests/old-style-connect/namespaces.cpp.fixed.expected

raw
1 #include <QtCore/QObject>
2 #include "namespaces.h" // Test that we use the most qualified name in headers
3
4 namespace Foo
5 {
6 class MyObj2 : public QObject
7 {
8 Q_OBJECT
9 public Q_SLOTS:
10 void separateNSSlot() {};
11 };
12 }
13
14 namespace Foo {
15 class MyObj : public QObject
16 {
17 Q_OBJECT
18 public:
19
20 public Q_SLOTS:
21 void slot1() {};
22 void slot2() {};
23 Q_SIGNALS:
24 void signal1();
25 };
26
27
28 void foo()
29 {
30 Foo::MyObj *o1 = new Foo::MyObj();
31 MyObj2 *o2;
32 QObject::connect(o1, &MyObj::signal1, o1, &MyObj::slot1); // Warning
33 QObject::connect(o1, &MyObj::signal1, o2, &MyObj2::separateNSSlot); // Warning
34 }
35
36 }
37
38 void foo2()
39 {
40 Foo::MyObj *o1;
41 Foo::MyObj2 *o2;
42 QObject::connect(o1, &Foo::MyObj::signal1, o1, &Foo::MyObj::slot1); // Warning
43 QObject::connect(o1, &Foo::MyObj::signal1, o2, &Foo::MyObj2::separateNSSlot); // Warning
44 }
45
46
47 using namespace Foo; // Comes after, so shouldn't have influence
48 int main() { return 0; }
49 #if QT_VERSION_MAJOR == 5
50 #include "namespaces.qt5.moc_"
51 #elif Q_MOC_OUTPUT_REVISION == 69
52 #include "namespaces.qt6.moc_69"
53 #else
54 #include "namespaces.qt6.moc_"
55 #endif