Hi,

I want to poll continuously some hardware functions like ..

Qt Code:
  1. main(int argc, char *argv[])
  2. {
  3. Widget w; // Widget Class
  4. QApplication a(argc, argv);
  5. while (1)
  6. {
  7. //functions to poll continuously
  8. }
  9.  
  10. w.show();
  11. a.exec();
  12.  
  13. }
To copy to clipboard, switch view to plain text mode 

If i execute above code it doesn't show widget on the display, I understand that a.exec() should execute to enter in to the event loop.

But if i write like this...

Qt Code:
  1. main(int argc, char *argv[])
  2. {
  3. Widget w; // Widget Class
  4. QApplication a(argc, argv);
  5.  
  6. w.show();
  7. while (1)
  8. {
  9. //functions to poll continuously
  10.  
  11.  
  12. a.exec();
  13. }
  14.  
  15. }
To copy to clipboard, switch view to plain text mode 

in while loop only execute once, and then a.exec() wait for the event.
How can I run while loop continuously to poll some function.
Is it mean that I need to start QTimer and need timer event every time?

Or is there any other way that can use while loop?

With Regards,
Nirav