Hi, I just started learning Qt several days ago, and I got stuck on this for a while now. I'm trying to create a new thread in which a QTimer would run, and connect the timer's timeout() signal to a function running in that thread. Here is one of the things that I tried:

I try to run a timer here connected to a slot in MyObject (onTimeOut)
Qt Code:
  1. class MyThread : public QThread
  2. {
  3. public:
  4. MyThread();
  5. ~MyThread();
  6.  
  7. QTimer *timer;
  8. void run();
  9. };
  10.  
  11. void MyThread::run()
  12. {
  13. MyObject object;
  14. timer = new QTimer;
  15. connect(timer, SIGNAL(timeout()), &object, SLOT(onTimeOut()));
  16. timer->start(500);
  17. exec();
  18. }
To copy to clipboard, switch view to plain text mode 
To my understanding this should call onTimeOut every half second, but that's not happening. Is there something that I'm missing completely?