Hi there,

I am playing around with QThreads for the first time. And now I have the weird problem that the QTimer in my thread class doesn't start or emit the timeout() signal. Some code:
Qt Code:
  1. CanThread::QCanThread( QObject* parent )
  2. : QThread( parent )
  3. {
  4. m_countTimer = new QTimer( this );
  5. m_countTimer->setInterval( 1000 );
  6. connect( m_countTimer, SIGNAL(timeout()), this, SLOT(updateCounter()) );
  7. }
  8.  
  9. void CanThread::run() {
  10. m_countTimer->start();
  11. exec();
  12. }
  13.  
  14. void CanThread::stop() {
  15. m_countTimer->stop();
  16. this->quit();
  17. }
  18.  
  19. void QCanThread::updateCounter() {
  20. m_currentCounter++;
  21. emit showCurrentCounter( m_currentCounter );
  22. }
To copy to clipboard, switch view to plain text mode 
The timer m_countTimer shall timeout all 1000ms. As reaction a counter variable is incremented and the GUI is signalled to display that variable.
(I know it is bullshit to do this that way. A simple timer and the GUI without my CanThread would be enough, but I want get a feeling how deal with threads)

But the slot updateCounter() is never called. Either the timer doesn't start when I call threadObject->start() or the timer doesn't emit its signal timeout().
What is wrong with my code?