Please read the documentation. It's stated on multiple pages that ALL of the user interface needs to be in the main thread.
You can NOT do user interface related things in a separate thread.
This does NOT mean you can't make your program multithreaded though.
Connections across threads NEED to be queued. Signals and slots are handled in the event loop of the object. If an object lives in a different thread, it has a different event loop and you need to wait till the receiving object is in its own event loop. Therefor you need a queued connection.2. Emitting signals to MainWindow. Seems to work correctly, but only when qt::queuedconnection was set. If I set it to direct connection program throws the same ASSERT failure in debug mode. I am not satisfied with queued connection, because I want to increment progressbar`s value immediately, not when thread finishes.
It's not true that you need to wait for a thread to finish before you can send something.
But if this is all a little bit too difficult, I suggest you take a look at QtConcurrent and use a Future watcher.





Reply With Quote

Bookmarks