This is my header:
Qt Code:
  1. #ifndef ALARMH_H
  2. #define ALARMH_H
  3.  
  4. class Alarm : public QObject
  5. {
  6. Q_OBJECT
  7.  
  8. public:
  9. Alarm(QString file)
  10. {
  11. // code here
  12. }
  13. int parseXML(QDomDocument doc, QString file)
  14. {
  15. // code here
  16. }
  17. void checkAlarm()
  18. {
  19. QTimer *timer = new QTimer(this);
  20. connect(timer, SIGNAL(timeout()), this, SLOT(checkTime()));
  21. qDebug() << timer->timerId();
  22. timer->start(100);
  23. }
  24. private:
  25. QString alarmName;
  26. QTime alarmTime;
  27. QDate alarmDate;
  28. QString alarmSound;
  29. QString alarmMessage;
  30. QString alarmApp;
  31. QString alarmAppArg;
  32.  
  33. signals:
  34. void soundAlarm();
  35.  
  36. private slots:
  37. void checkTime()
  38. {
  39. qDebug() << "check ....";
  40. }
  41.  
  42.  
  43. };
  44. #endif // ALARMH_H
To copy to clipboard, switch view to plain text mode 

I use it in .cpp:
Qt Code:
  1. Alarm a(filename);
  2. a.checkAlarm();
To copy to clipboard, switch view to plain text mode 

But the timer somehow does not call the SLOT once it's timed out. Probably my mistake, but where?