See QRunnable and QThreadPool or better yet QtConcurrent::run.