it's bad idea to use Qt:: DirectConnection between threads, Qt::QueuedConnection must be used.
it's bad idea to use Qt:: DirectConnection between threads, Qt::QueuedConnection must be used.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
I tried Qt::QueuedConnection and nothing changed.
yes, because by default last parameter in 'connect' is Qt::AutoConnection, which means
try to use customs events, but I think result will not change.If the signal is emitted from the thread in which the receiving object lives, the slot is invoked directly, as with Qt:: DirectConnection; otherwise the signal is queued, as with Qt::QueuedConnection.
ps. if you use thread just for loading information and don't transform it then you can you only main thread and use qApp->processEvents() in long time operations.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
a) Qt::QueuedConnection is the default for threads. So explicitly specifying it won't change anything.
b) simple solutions might be
- emit the signal not every time but only every 100th time (or so)
- just open the file in a normal function call, update the gui and call QCoreApplication::processEvents() now and then
- do not use a thread
- use a plain callback (do not forget to synchronize access! and don't forget you must not call gui code from another thread!)
HTH
Bookmarks