I love the way signals and slots works compared to callback functions, but I'm having a problem that I might have solved in an awkward way.
I have two classes, class A and B. I create an instance of each, and then somewhere in class A, I have to emit a signal to a slot in class B.

But how do I get that instance of B at runtime?


What I did (which is the awkward part):

Qt Code:
  1. A foo;
  2. B bar;
  3.  
  4. QObject::connect(&foo, SIGNAL(someSignal()), &bar, SLOT(someSlot()));
To copy to clipboard, switch view to plain text mode 

I've used signals and slots once before (about a week ago), so I know how they work (I think), but there is some other way to do this, I hope..is there?

Thanks!