In this case you should use a direct connection, otherwise timeout events will be queued in... the main event loop, since MyClass instance belongs to the GUI thread.
In this case you should use a direct connection, otherwise timeout events will be queued in... the main event loop, since MyClass instance belongs to the GUI thread.
Jacek, do you mean when he want to use the QTimer and exec() method, he need to connect using Qt:irectConnection in order to let the timer event to be triggered and run in a the same thread as the thread using in run()?
Yes, that's what I meant.Originally Posted by ball
Sorry guys,
I don't got it. (using DirectConnection)
The stange thing is that the first variant works fine.
I thought that getting a timer to trigger the work instead of a wait would be a little more elegant. But the timer way doesn't work. I don't get any messages that the connect() doesn't work.
note also (although perhaps beside the point): I have emits in the update() func and they work fine into the gui thread.
any ideas?
thanks
K
How did you start it?Originally Posted by TheKedge
I call
start()
from the constructor of my class. Or more precisely, I have an init() func called a single shot timer in the constructor. Thus:
QTimer::singleShot(0, this, SLOT(init()));
start() is called from the init() func.
As said, the thread is running -> the loop/sleep method works. But I have the feeling somethings not right with the connect() (although I don't get any error messages)
K
Does it work with queued connection?
TheKedge (25th August 2006)
Bookmarks