Re: [Interest] Never ending thread: blocking GUI

2012-10-17 Thread André Somers
Op 17-10-2012 1:15, Lincoln Ramsay schreef: > On 17/10/12 01:00, Sensei wrote: >> So, if in my main thread every time I need to search I will create a >> thread, a searcher, move the searcher to the new thread. > You should probably just keep these objects around rather than > recreating them all t

Re: [Interest] Never ending thread: blocking GUI

2012-10-16 Thread Lincoln Ramsay
On 17/10/12 01:00, Sensei wrote: > So, if in my main thread every time I need to search I will create a > thread, a searcher, move the searcher to the new thread. You should probably just keep these objects around rather than recreating them all the time. > Am I leaking memory? Yes... > How ca

Re: [Interest] Never ending thread: blocking GUI

2012-10-16 Thread Igor Mironchik
16.10.2012 18:00, Sensei пишет: > Am I leaking memory? I understand that I'm doing so. How can I delete > these objects? I mean the thread, searcher, and their parameters, in > this case. Thanks! In slot connected to the result signal do: thread->quit(); thread->wait(); thread->deleteLater(); s

Re: [Interest] Never ending thread: blocking GUI

2012-10-16 Thread Sensei
On 10/16/12 3:34pm, Lincoln Ramsay wrote: > You want an async QObject-based interface (call in via slot, answer via > signal). I see what you mean. I went this way and I'm quite happy, so thanks a lot! Here's the awesome output with two different threads! emitting signal on thread 0x7fff7cee618

Re: [Interest] Never ending thread: blocking GUI

2012-10-16 Thread Bo Thorsen
Den 16-10-2012 15:34, Lincoln Ramsay skrev: > On 16/10/12 11:15 PM, Sensei wrote: >> Once in a while, when the GUI needs it, it will "wake the thread up", >> and run a method of my QThread subclass, in my case, a "find in files" >> or "rename all files", or any other method. >> >> I thought I could

Re: [Interest] Never ending thread: blocking GUI

2012-10-16 Thread Igor Mironchik
16.10.2012 16:15, Sensei пишет: > This is quite easy: I want to start a thread that never ends. Just call exec() in your run() method. And it will start event loop that will work untill you call exit() or quit() in you thread. And don't forget to start() your thread. > Once in a while, when the

Re: [Interest] Never ending thread: blocking GUI

2012-10-16 Thread Lincoln Ramsay
On 16/10/12 11:15 PM, Sensei wrote: > Once in a while, when the GUI needs it, it will "wake the thread up", > and run a method of my QThread subclass, in my case, a "find in files" > or "rename all files", or any other method. > > I thought I could simply make run() be an infinite loop, sleeping fo

Re: [Interest] Never ending thread: blocking GUI

2012-10-16 Thread Tibold Kandrai
Or you could use ThreadPools, depending on the task you need to accomplish: http://doc.qt.digia.com/stable/qthreadpool.html Tibold On 2012-10-16 15:24, Tibold Kandrai wrote: > Hi, > > If you want a QThread to handle something Q related like, events or > Queued SLOTS, you need to start an event lo

Re: [Interest] Never ending thread: blocking GUI

2012-10-16 Thread Atlant Schmidt
s+aschmidt=dekaresearch@qt-project.org] On Behalf Of Sensei Sent: Tuesday, October 16, 2012 9:15 AM To: Qt Interest Subject: [Interest] Never ending thread: blocking GUI Hi! I am in the middle of a crisis, since I thought I understood threads, but I might be wrong! This is quite easy: I wan

Re: [Interest] Never ending thread: blocking GUI

2012-10-16 Thread Tibold Kandrai
Hi, If you want a QThread to handle something Q related like, events or Queued SLOTS, you need to start an event loop. This is what you need: http://qt-project.org/doc/qt-4.8/QEventLoop.html But I don't know why did it hang your UI because that depends on how did you call your SLOT. BTW a few yea

[Interest] Never ending thread: blocking GUI

2012-10-16 Thread Sensei
Hi! I am in the middle of a crisis, since I thought I understood threads, but I might be wrong! This is quite easy: I want to start a thread that never ends. Once in a while, when the GUI needs it, it will "wake the thread up", and run a method of my QThread subclass, in my case, a "find in fil