[Qt-interest] Thread calling Thread and Signal/Slots
Sean Harmer
sean.harmer at maps-technology.com
Mon Mar 30 18:10:17 CEST 2009
On Monday 30 March 2009 17:03:25 Matthias Pospiech wrote:
> If I call exec() then my thread is not doing anything anymore because it
> stops at exec()
>
> void run()
> {
> exec();
> m_stopped = false;
> Init();
> Calculation();
> emit finishedCalculation(!m_stopped);
> m_stopped = true;
> }
>
>
> so, how is exec() supposed to work ???
You are mixing design patterns here. You say you wan to use signals/slots
across threads - this demands an event loop to be running. However, your run()
function in your example here is written in a blocking manner. Why do you need
to use a slot in this thread? Why can't you just call QThread::start()?
It might help if you could provide a small example (e.g. the main function and
two thread classes) or some more detail of what you are trying to do.
Cheers,
Sean
More information about the Qt-interest-old
mailing list