Quantcast
Channel: Installation and Deployment
Viewing all articles
Browse latest Browse all 22112

[SEMI-SOLVED] Update loop in Qt? QTimer no longer working...

$
0
0
I’m using Qt on top of a game and I need to call an update function regularly. I once did this by having a QTimer, with 0 in interval, calling an update function similar to what you see below. class Window : public QMainWindow {  Q_OBJECT   private:  QTimer timer;   public:  Window()  {   timer.setInterval(0);   timer.start();   connect(&timer, SIGNAL(timeout()), this, SLOT(update()));  }   public slots:  void update()  {   // Update game logic  } }; I don’t remember the exact Qt version I used, but this used to work without any problems. However, in Qt 4.8.4 and Qt 5, the window “freezes”, probably due to QTimer receiving all execution time without the GUI updating in between. Does anyone know how to solve this?

Viewing all articles
Browse latest Browse all 22112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>