How to create Thread in Qt c++;
i developed one simple application on Qt .now i want thread creation using this i want to generate progress bar function.
hi,see this article also:http://blog.debao.me/2013/08/how-to-use-qthread-in-the-right-way-part-1/
Hi @Pranit-Patil !
The first thing you need to remember is that GUI items should not be created in any thread other than the main thread. QTimers are especially tempermental I have found to only respond to the owning thread.
What I typically do, is create the QProgress or QMovie (for ajax style) in the main thread. My worker thread then just shows and set values. If you want something global (across DLLs and plugins) I typically have some forwarding signals in the qApp. This allows consistent user interface experience for progress. My progress singleton interface connects to those and the plugin or thread or other object simply calls into it.
Using a worker thread, keeps the design simple. I am starting to like QtConcurrent since I am using more worker functions in a larger object to process data (like files). You have a lot of control over the threads and they are run from a pool so you can reuse the resources easier.
Another really good blog: https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/