File indexing completed on 2024-05-05 05:41:36

0001 #include <QtCore/QObject>
0002 
0003 class MyObject : public QObject
0004 {
0005     Q_OBJECT
0006 public:
0007     bool getter1() const;
0008     void nonGetter1() const;
0009     bool nonGetter2();
0010 public Q_SLOTS:
0011     bool slot1() const { return true; } // Warn
0012     bool slot2() { return true; } // OK
0013 
0014     bool slot3() const; // Warn
0015     bool slot4(); // OK
0016     const int slot5(); // OK
0017     void slot6() const {} // OK
0018     Q_INVOKABLE int invokable1() const; // OK
0019     Q_SCRIPTABLE int scriptable1() const; // OK
0020 Q_SIGNALS:
0021     void signal1() const; // Warn
0022     void signal2(); // OK
0023     Q_INVOKABLE int invokable2() const; // OK
0024     Q_SCRIPTABLE int scriptable2() const; // OK
0025 public:
0026     Q_INVOKABLE int invokable3() const; // OK
0027     Q_SCRIPTABLE int scriptable3() const; // OK
0028 
0029 };
0030 
0031 bool MyObject::slot3() const // OK, already warned
0032 {
0033     return true;
0034 }
0035 
0036 bool MyObject::slot4()
0037 {
0038     return true;
0039 }
0040 
0041 void test()
0042 {
0043     MyObject o;
0044     o.connect(&o, &MyObject::signal1, &MyObject::getter1); // Warn
0045     o.connect(&o, &MyObject::signal1, &MyObject::nonGetter1); // OK
0046     o.connect(&o, &MyObject::signal1, &MyObject::nonGetter2); // OK
0047 }
0048 
0049 void bug386940()
0050 {
0051     MyObject o;
0052     QObject::connect(&o, &MyObject::signal1, []{}); // OK
0053 }