Tuesday, 27 March 2018

TrafficControl: Displaying the Simulated Time

A very important feature of trafficControl is the simulated time. Since it is possible to adjust the speed of the simulations, the simulated time (system time) should be visible in the user interface.

Adding a QTime variable (simulatedTime) is easy. That parameter is incremented by one for every tick, and a signal is sent.

The signal is relayed from trafficClock via NetworkControl to trafficControl


Finally, the corresponding label is updated. 


For every tick, the time is incremented by one second.

When running the program in test mode, there is no listener to the signals. This won't cause any crashes.

In the next blog post, I'll review the trafficClock objects. I hope that I'll be able to connect the signal directly fom trafficClock to trafficControl.

No comments:

Post a Comment