They are doing it there because they are defining the objects there. You can call connect everywhere you like, but you must have valid pointers to the objects you like to connect. In your case you created a new instance of first/second and used that. But this instances aren't identical with that ones you have created in main function and which you actually use.
Man not only did you help me with my problem it looks like you can read minds.
i was looking againt at the working code to see exactly what was the root of my problem.
And an after a refresh y see this.
I understand now that i need to pass the same object to the connect than i used to show() the form.
creating a new instance does not work because well is a new instance and not the one i was seeing.
Again. Thank you.
Edit. Also for future reference this is the working way.
MainWindow win;
win.resize(1024, 768);
win.show();
debug deb;
deb.show();
QObject::connect(&win,
SIGNAL( MySignal
() ),
&deb,
SLOT( MySlot
() ));
MainWindow win;
win.resize(1024, 768);
win.show();
debug deb;
deb.show();
QObject::connect(&win, SIGNAL( MySignal() ),&deb, SLOT( MySlot() ));
To copy to clipboard, switch view to plain text mode
Bookmarks