I have a canvas on which I am drawing a set of points. They are supposed to move as a function of time (sort of like a series of planets moving under gravity). I want the canvas to be continuously refreshed with the new positions of the points.

I guess I need to somehow combine a QTimer and a QThread (to avoid a never ending loop) but I'm not sure how to combine them. Should I start a thread and put a timer in it which every so often calculates the new positions and updates the view or maybe I am supposed to start a timer loop which starts a new thread every time the calculation needs to be made?

Any help would be greatly appreciated.