salmanmanekia
13th August 2008, 13:01
i have written a piece of code in which i update my view after every millisecond ,i do this by clicking a button,but when i reclick the button the view is updated twice the speed of its previous update and this speed seems to increase by every click..here is some code to give you a idea..
QTimer *timerProg;
..
timerProg = new QTimer();
..
void Progress::startProgress()
{
rec_button = TRUE;
connect(timerProg,SIGNAL(timeout()),this,SLOT(adva nce()));
timerProg->start(ROTATION_TIME);
}
void Progress::advance()
{
if(rotation < 260)
{
rotation += ANGLE_INCREASE;
rotation %= TOTAL_ROTATION;
update();
}
else
{
timerProg->stop();
rotation = -90;
}
}
QTimer *timerProg;
..
timerProg = new QTimer();
..
void Progress::startProgress()
{
rec_button = TRUE;
connect(timerProg,SIGNAL(timeout()),this,SLOT(adva nce()));
timerProg->start(ROTATION_TIME);
}
void Progress::advance()
{
if(rotation < 260)
{
rotation += ANGLE_INCREASE;
rotation %= TOTAL_ROTATION;
update();
}
else
{
timerProg->stop();
rotation = -90;
}
}