Sunday, December 7, 2014

Adventures in Threading

So after stumbling for a while I managed to crack Qt's moveToThread(). Source at above link. Its has working code for big file copy in thread.
We have only left one small problem, and that is if the function we are calling on thread start has any arguments to pass, then we won't be able to directly connect it to thread's started() signal.
So in this case we should subclass thread and pass the arguments to the custom thread object and then inside it emit an appropriate signal to call the main class's function. It seems like such a complex way to do such a simple task like "run this function on a separate thread!" :D

No comments:

Post a Comment