Warning, /sdk/clazy/tests/old-style-connect/q_private_slot.cpp.fixed.expected is written in an unsupported language. File is not indexed.

0001 #include <QtCore/QObject>
0002 
0003 class MyObj : public QObject
0004 {
0005     Q_OBJECT
0006     MyObj()
0007     {
0008         connect(this, SIGNAL(destroyed()), SLOT(privSlot()));
0009         connect(this, SIGNAL(destroyed()), this, SLOT(privSlot()));
0010         connect(this, SIGNAL(destroyed()), this, SLOT(privSlot2()));
0011     }
0012 public:
0013     class Private;
0014     Private * d;
0015     Q_PRIVATE_SLOT(d, void privSlot())
0016     Q_PRIVATE_SLOT(d, void privSlot2())
0017 signals:
0018     void privSlot2(); // Signal with the same name as private slot
0019 };
0020 
0021 class MyObj::Private
0022 {
0023 public:
0024     Private()
0025     {
0026         q->connect(q, SIGNAL(destroyed()), SLOT(privSlot()));
0027         q->connect(q, SIGNAL(destroyed()), q, SLOT(privSlot()));
0028         QObject *other;
0029         q->connect(other, SIGNAL(destroyed()), SLOT(privSlot()));
0030     }
0031 
0032     void somePrivFunction();
0033 
0034 public Q_SLOTS:
0035     void privSlot();
0036     void privSlot2();
0037 private:
0038     MyObj *q;
0039 };
0040 
0041 void MyObj::Private::somePrivFunction()
0042 {
0043     QObject *other;
0044     q->connect(other, SIGNAL(destroyed()), SLOT(privSlot()));
0045     q->connect(other, SIGNAL(doesnt_exist()), SLOT(privSlot()));
0046 }
0047 
0048 int main() { return 0; }