Hi!

Due to the well known bug with TableView in combination with sorting I had to switch from
Qt 4.3 to Qt 4.4. Everything went pretty well until it tried my threading-classes. Here I have a strange issue which I haven't had with Qt 4.3. I wrote a small example:

mythread.h:
Qt Code:
  1. #ifndef MYTHREAD_H
  2. #define MYTHREAD_H
  3.  
  4. #include <QThread>
  5. #include <QTimer>
  6. #include <QDebug>
  7.  
  8. class MyThread : public QThread
  9. {
  10. Q_OBJECT
  11. public:
  12. MyThread(QObject *parent = 0) : QThread(parent){}
  13. ~MyThread(){ delete timer;}
  14.  
  15. void run(void)
  16. {
  17. qDebug() << "head of run";
  18. timer = new QTimer;
  19. timer->setSingleShot(true);
  20. timer->setInterval(1000);
  21.  
  22. connect( timer, SIGNAL(timeout()), this, SLOT(restartTimer()));
  23.  
  24. timer->start();
  25.  
  26. qDebug() << "about to start event loop";
  27. exec();
  28.  
  29. }
  30.  
  31. private slots:
  32. void restartTimer(void)
  33. {
  34. timer->start();
  35. qDebug() << "Timer restarted";
  36. }
  37.  
  38. private:
  39. QTimer *timer;
  40. };
  41.  
  42. #endif //MYTHREAD_H
To copy to clipboard, switch view to plain text mode 

main.cpp:
Qt Code:
  1. #include <QtGui>
  2. #include "mythread.h"
  3.  
  4.  
  5. int main(int argc, char* argv[])
  6. {
  7. QApplication app(argc, argv);
  8.  
  9. MyThread thread;
  10. thread.start();
  11.  
  12. return app.exec();
  13. }
To copy to clipboard, switch view to plain text mode 

When I compile it with Qt 4.4.0 I get the following output:
head of run
about to start event loop
QObject::startTimer: timers cannot be started from another thread
Timer restarted

And then nothing. Which is logical because it can't access the timer. But why?
Maybe someone could try this code on his machine. It would be really great!
Or maybe someone could tell me why this doesn't work...

Have a nice evening

Col