[Qt-interest] Fwd: Re: Thread calling Thread and Signal/Slots

Sean Harmer sean.harmer at maps-technology.com
Mon Mar 30 18:06:59 CEST 2009


Forwarding to list.
----------  Forwarded Message  ----------

Subject: Re: [Qt-interest] Thread calling Thread and Signal/Slots
Date: Monday 30 Mar 2009
From: Matthias Pospiech <matthias.pospiech at gmx.de>
To: Sean Harmer <sean.harmer at maps-technology.com>

Sean Harmer schrieb:
> Hi,
>
> On Monday 30 March 2009 16:49:50 Matthias Pospiech wrote:
>   
>> My Gui is calling a Thread which itself is calling another Thread.
>>
>> The Threads should communicate with Signal/Slots. Do I have to call
>> exec() in that case and if, where has that to be placed?
>>     
> If your threads need to respond in slots, then each thread will need to call 
> exec() in its run() function. This is because when using signals/slots 
across 
> thread boundaries you must have the event loop running in the receiving 
> thread.
>   
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 ???

Matthias


-------------------------------------------------------



More information about the Qt-interest-old mailing list