[Qt-interest] Trying to understand Signal/slots.
phil prentice
philp.cheer at talktalk.net
Sat Aug 21 17:25:55 CEST 2010
Hi
Thankyou for reading this. I have an application that supports multiple
application windows. These windows are created when one of my threads in the
application receives a message from an external process via a socket.
My main application creates a thread (m_iconThread). The thread awaits
messages, which when received emits a signal to the main application thread
which then creates the new window.
So my thread run() method performs an
emit(openVIwindow(viData));
My main application thread connects this thread to a socket i.e.
connect(&m_iconThread, SIGNAL(openVIwindow(QString)),
this, SLOT(openVIwindow(QString)));
This all seems to work very well, but I think that I have got something badly
wrong.
If I open a modeless dialog in one of my application windows I would have half
expected that any new openVIwindow signals would not be serviced until the
modeless dialog returned so freeing up the event loop of the main
application?
I assume that the emit signal would have caused a queued signal to be sent to
the main application because its being sent from a different thread? Is this
assumption where I've got it wrong?
Is what I am doing wrong the fact that m_iconThread object was created in the
same thread as the applications so regardless of which thread is doing the
emitting, the slot is being called directly and so the actual run thread is
creating the new window itself directly.....which I assume is a BIG NO-NO?
I am very happy with the way the application is working at the moment, but I
just think that I'm just doing it wrong?? And I will probably get problems
later???
Thanks for your help
Phil
More information about the Qt-interest-old
mailing list