You have to create a new thread (with QThread) and place in it this unending loop.
See also this.