File indexing completed on 2024-05-05 05:41:36
0001 #include <QtCore/QObject> 0002 0003 #define DECLARE_SIGNAL(name) \ 0004 Q_SIGNALS: \ 0005 void name(); 0006 0007 class MyClass : public QObject 0008 { 0009 Q_OBJECT 0010 0011 public: 0012 explicit MyClass(QObject *parent = 0); 0013 DECLARE_SIGNAL(mySignal) 0014 0015 public slots: 0016 void mySlot(); 0017 }; 0018 0019 MyClass::MyClass(QObject *parent) : QObject(parent) 0020 { 0021 connect(this, &MyClass::mySignal, this, &MyClass::mySlot); 0022 }