sujan.dasmahapatra
21st June 2010, 12:54
Dear Friends
I have a QTimer started, now I want wait till the timeout() signal emitted, how can I hang the program for a certain period of time but the timer started should keep emitting its signal. I am not sure how to achieve this , I have been trying something like this.
MainWindow::startTimer() {
QTimer * timer = new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(update() ));
timer->start(60000);
}
MainWindow::update()
{
if() // if the job is done then
{
timer->stop();
}
else // wait for the next signal to be emitted after 1 min
{
waitcondition.wait(&mutex);
// Here the problem when its coming here its waiting for an uncertain time its not able to capture the timeout()
// signal anymore..... How can I achieve this please give me some hint fi anyone knows. Thanks
}
}
I have a QTimer started, now I want wait till the timeout() signal emitted, how can I hang the program for a certain period of time but the timer started should keep emitting its signal. I am not sure how to achieve this , I have been trying something like this.
MainWindow::startTimer() {
QTimer * timer = new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(update() ));
timer->start(60000);
}
MainWindow::update()
{
if() // if the job is done then
{
timer->stop();
}
else // wait for the next signal to be emitted after 1 min
{
waitcondition.wait(&mutex);
// Here the problem when its coming here its waiting for an uncertain time its not able to capture the timeout()
// signal anymore..... How can I achieve this please give me some hint fi anyone knows. Thanks
}
}