Hi. I'm new to QT and I have a good-programming-style-type problem. I want to connect 2 objects. Until now , i wrote some simple applications , and connected objects that one contains another. For example:

Qt Code:
  1. class c : public QWidget
  2. {
  3. private:
  4. QPushButton *button;
  5. public:
  6. c()
  7. {
  8. ...
  9. connect(button,SIGNAL(signal()),this,SLOT(slot()));
  10. ...
  11. }
  12. };
To copy to clipboard, switch view to plain text mode 

And it was simple and easy.

But what if i want to connect to objects that none of them is containing another ? In "connect" i have to pass pointers to sender and reciever. Should I pass the pointer to another object in a constructor ? For example:
Qt Code:
  1. class ObjectA : public QWidget
  2. {
  3. ...
  4. public slots:
  5. void slot();
  6. ...
  7. };
  8.  
  9. class ObjectB : public QWidget
  10. {
  11. ...
  12. signals:
  13. void signal();
  14. public:
  15. ObjectB(ObjectA *p)
  16. {
  17. ...
  18. connect(this,SIGNAL(signal()),p,SLOT(slot()));
  19. ...
  20. }
  21. };
To copy to clipboard, switch view to plain text mode 

Is that a good way to do that ? It works, but I believe something is wrong with that. What if i want to connect one object with twenty anothers , so i neet do pass 20 pointers in a constructor ?