1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #include <stdio.h>
- #include "example_c3.h"
- A::A(QObject *parent = 0, const char *name = 0)
- : QObject(parent, name)
- {
- }
- void A::emitSigA()
- {
- printf("A: emitting sigA!\n");
- emit sigA();
- }
- void A::gotSigB()
- {
- printf("A: got sigB!\n");
- }
- B::B(QObject *parent = 0, const char *name = 0)
- : QObject(parent, name)
- {
- }
- void B::emitSigB()
- {
- printf("B: emitting sigB!\n");
- emit sigB();
- }
- void B::gotSigA()
- {
- printf("B: got sigA!\n");
- }
- int main(void)
- {
- A *a = new A(0, "class a");
- B *b = new B(0, "class b");
- QObject::connect(a, SIGNAL(sigA()), b, SLOT(gotSigA()));
- QObject::connect(b, SIGNAL(sigB()), a, SLOT(gotSigB()));
- a->emitSigA();
- b->emitSigB();
- delete b;
- delete a;
- return 0;
- }
|