QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), logic, SLOT( nextTimeStep() ) ); connect(timer, SIGNAL(timeout()), ballGraph, SLOT(nextAnimationFrame())); timer->start(100);
} </syntaxhighlight> Mostly, it is the same as before, now we only define the pointers for the xy-plot and the ball-logic and give those pointers to the constructor of the ball-drawing widget. We add the drawing widget to the layout. The widgets are added from the left to the right: the first goes left, the second goes to the right of that and so on.