Qt Code:
  1. // Inside the main window class constructor
  2. ...
  3.  
  4. timer.setInterval(0);
  5.  
  6. connect(...)
  7.  
  8. t0 = tbb::tick_count::now();
  9.  
  10. ...
  11.  
  12. MyMainWindow::OnIdle()
  13. {
  14. t1 = tbb::tick_count::now();
  15. if ((t1 - t0).seconds() < ...) {
  16. // do nothing
  17. } else {
  18. // do something...
  19. }
  20. pApp->processEvents();
  21. }
To copy to clipboard, switch view to plain text mode