PDA

View Full Version : How to keep updating the Qt-Application?



mayanka_medhe
22nd June 2018, 03:13
Hi!
I am trying to make a 3D map using Qt-Application. My input keeps on updating with time. I have written a program which will display the map but I am not able to find any suitable function to update the application. I have to close the application every time to view the updated map. Can someone suggest a method to do the same?

I am using Qt version 4.8.7 on Ubuntu 16.04.

Thanks in advance!

d_stranz
22nd June 2018, 17:03
Is the map stored in a file? In that case, you can use QFileSystemWatcher and give it the name of the file you want it to watch. When the file changes, the class will emit the QFileSystemWatcher::fileChanged() signal. In your slot that handles that signal, you can reload the map.

Ginsengelf
26th June 2018, 07:17
Another option would be to use a QTimer to regularly update the map. Disadvantage is that this approach might run updates even when nothing changed on the source data. When it is usable d_stranz' approach will be more efficient because it will only update when the data has changed.

Ginsengelf