[Qt-interest] Create a new GUI Thread

Guido Moonen gmoonen at nr34.nl
Mon Mar 2 23:10:24 CET 2009


Andreas Pakulat schreef:
> On 02.03.09 15:05:06, Luke Campagnola wrote:
>   
>> On Wed, Feb 11, 2009 at 01:37, Andreas Pakulat <apaku at gmx.de> wrote:
>>     
>>> On 11.02.09 02:04:52, Luis Roberto P. Paula wrote:
>>>       
>>>> I'm doing this because I need to have a different event loop for the
>>>>         
>>> QDialog
>>>       
>>>> window.
>>>>         
>>> So you want two event loops that run in parallel, not one loop that blocks
>>> the other (which can be done with QDialog::exec())? May I ask why?
>>>
>>> As to how to do that: The only way is putting the code that needs to run in
>>> the second event loop into a separate application and then use IPC (like
>>> QDBus) to communicate between the two processes.
>>>       
>> Is there some technical limitation in Qt that makes it unable to control two
>> separate windows from different threads? I'd be absolutely thrilled if a
>> future version of Qt would allow this behavior. I've seen variations on this
>> question asked so many times that I'm sure I'm not alone..
>>
>> Here's my current problem: I am writing a data acquisition/analysis
>> application that does an enormous amount of number crunching and graphical
>> output in realtime. The program is running on a quad-core machine and I have
>> as much data processing as possible shuffled out to other threads, but the
>> entire GUI (three windows spread across two monitors) is forced to run on
>> one core and is becoming a bottleneck.
>>
>> So my option now is to split the program into fragments,  put the
>> application state into shared memory, and design an IPC protocol to handle
>> all of the communication that was originally seamless? Maybe I could run the
>> second window using GTK and the third using TK?
>>
>> Can anybody tell me if this issue is being considered by the Qt developers?
>> Is it even possible to fix at all?
>>     
>
> No, its not possible to fix this, at least not in a cross-platform way.
> On some platforms GUI operations simply have to be done from one thread,
> because the underlying windowing system is not threadsafe.
>
> Andreas
>
>   
Hi

And why would you want to, you only have one user, so one thread for 
interaction with the user can be done in one thread,

AFAIK If you need to process big blobs of data on different CPU's and 
thus threads you can still send signals to you main gui thread which can 
trigger all updates needed in the main gui thread, the normal connect() 
can be used for connection between threads, just make sure the object 
"live" in the correct threads. (Sender in the processing thread and 
receiver in the GUI thread)

Guido.



More information about the Qt-interest-old mailing list