Hi !
if a situation meeting certain conditions occurs, I display a warning message (with a QMessageBox). I use a QTimer to remind the user 5 minutes later that the situation is still happening :
void data::data()
{
warning1=true;
}
void data::event ()
{
Qtimer
*timer2
= new QTimer(this);
QObject::connect( timer2,
SIGNAL(timeout
()),
this,
SLOT(warning1_timer2
()));
if (((condition1)||(condition2))&&(warning1) ) //Conditions
{
warning1=false;
{
timer2->start(300000);
}
}
}
void Data::warning1_timer2()
{
warning1=true;
}
void data::data()
{
warning1=true;
}
void data::event ()
{
Qtimer *timer2 = new QTimer(this);
QObject::connect( timer2, SIGNAL(timeout()),this,SLOT(warning1_timer2()));
if (((condition1)||(condition2))&&(warning1) ) //Conditions
{
warning1=false;
int answer = QMessageBox::warning(this, "Problem detected",QMessageBox::Ok);
if (answer == QMessageBox::Ok)
{
timer2->start(300000);
}
}
}
void Data::warning1_timer2()
{
warning1=true;
}
To copy to clipboard, switch view to plain text mode
This works when the situation occurs once...If the situation is still occuring five minutes later, the QMessageBox appears once again but freezes..I know this is due to the statement timer2->start();, but I can't find how to solve my problem!!!
Thanks for your help !!!
Bookmarks