title: QT C++ wait till specific time to execute function
body: <p>I am trying to create an app that holds a list of tasks and for each time a deadline, now i want to execute a function (show a popup) once a deadline is met.</p>
  
  <p>i have this:</p>
  
  <pre><code>#ifndef TIMER_H
  #define TIMER_H
  #include &lt;QWidget&gt;
  #include &lt;QTimer&gt;
  #include &lt;QtGui&gt;
  #include &lt;QObject&gt;
  
  class Timer : public QWidget
  {
      Q_OBJECT
  public:
      Timer(QWidget * parent = 0);
      void setTimer(QString title, QString description, QDate date, QTime reminderTime);
  public slots:
      void showWarning() {QString show = tit;
                          QPushButton * thanks = new QPushButton(QObject::tr("Thank you for reminding me!"));
                          show.append("\n");
                          show.append(des);
                          QMessageBox popup;
                          popup.setText(show);
                          popup.setWindowTitle("Calendar : Reminder");
                          popup.setDefaultButton(thanks);
                          popup.exec();
                         }
  private:
      QString tit;
      QString des;
      QDateTime now;
      QDateTime timeoftheaction;
      QTimer *timer;
  };
  </code></pre>
  
  <p>cpp file:</p>
  
  <pre><code>#endif // TIMER_H
  #include "timer.h"
  #include &lt;iostream&gt;
  using namespace std;
  
  Timer::Timer(QWidget * parent)
      : QWidget(parent)
  {
  }
  
  void Timer::setTimer(QString title, QString description, QDate date, QTime reminderTime)
  {
      now.currentDateTime();
      timer = new QTimer;
      tit = title;
      des = description;
      timeoftheaction.setDate(date);
      timeoftheaction.setTime(reminderTime);
      connect(timer, SIGNAL(timeout()),this,SLOT(showWarning()));
      timer-&gt;start(now.secsTo(timeoftheaction)*1000);
  }
  </code></pre>
  
  <p>Yet function showWarning is never being called...
  no compilation errors, function showWarning works perfectly (tested)</p>
  
  <p>I think the error is in the connect but i am not sure...</p>