Is it possible to have several connections active and working simultaneously without using threads?
Is it possible to have several connections active and working simultaneously without using threads?
Off topic, but Op has circular reference => design error.
Main window composed of sslserver, and sslserver impl also needs full knowledge of MainWindow.
edit:
I think that main window code in your sslserver is just you being a bit confused. You want to be updating the existing mainwin nit creating a new one. So there you should emit a signal with the new count as an argument. Connect that signal to a slot on your mainwin, and from there you can update the label text
Last edited by amleto; 4th December 2012 at 21:52.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
Thanks, I see your point. I already tried SIGNAL-SLOT solution, but I guess I had some error on it. I'll give it another try and get back with the result.
I think I should add following to the sslserver.c:
Qt Code:
connect(thread, SIGNAL(finished()), main, SLOT(count_update()));To copy to clipboard, switch view to plain text mode
I'm not sure though what I should put to the third parameter? Certainly main is not correct. I think this was the problem I faced when I tried to use the SIGNALs for this issue.
Cheers!
sslserver should be emitting signal, therefore it should not be the one doing the connection.
mainwindow should connect to sslserver
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
Thank guys! I got it working. My problem was that I was not using pointer of object sslserver. With the following connection it worked out:
Qt Code:
SslServer *ptr_server = &server; connect(ptr_server, SIGNAL(count(int)), this, SLOT(update_count(int)));To copy to clipboard, switch view to plain text mode
Cheers!
that is good enough!Qt Code:
connect(&server, SIGNAL(count(int)), this, SLOT(update_count(int)));To copy to clipboard, switch view to plain text mode![]()
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
Bookmarks