Why do you create a timer2 object inside data::event() function (is it a slot?) ?

When you call data::event() again, there will be another "timer2" object and can cause memory leak (if your application doesn't freeze).

I suggest that you declare timer2 as a member of your class, create timer2 object in your constructor, set the interval, then connecting timer2 timeout() signal to your warning_timer2() slot.

Qt Code:
  1. data::data(...) : ...
  2. {
  3. ....
  4. timer2 = new QTimer(this);
  5. timer2->setInterval(300000);
  6. timer2->setSingleShot(true);
  7. connect(timer2, SIGNAL(timeout()), this, SLOT(warning_timer2()));
  8. ....
  9. }
To copy to clipboard, switch view to plain text mode 

Then, in your data::event()

Qt Code:
  1. void data::event ()
  2. {
  3. // Qtimer *timer2 = new QTimer(this);
  4. // QObject::connect( timer2, SIGNAL(timeout()),this,SLOT(warning1_timer2()));
  5.  
  6. if (((condition1)||(condition2))&&(warning1) ) //Conditions
  7. {
  8. warning1=false;
  9. int answer = QMessageBox::warning(this, "Problem detected",QMessageBox::Ok);
  10. if (answer == QMessageBox::Ok)
  11. {
  12. // timer2->start(300000);
  13. timer2->start();
  14. }
  15. }
  16. }
To copy to clipboard, switch view to plain text mode