Qt-interest Archive, April 2007
QTimer problems
Message 1 in thread
Hi,
I think my previous problems posted under QAction and emit is caused by
QTimer:
This is how i loop my scenario/simulation:
written in pseudo code:
class Controll:
{
ctor:
QTimer *timer = new QTimer(this);
}
void Controll::startSim()
{
sliderVal = 1000;
timer->start(sliderVal);
timeIncr();
}
void Controll::timeIncr()
{
timerArray.pop_front();
if (time matches with the timestamps in array)
animateMovementOnNodes();
timerval++;
}
void Controll::stopSim()
{
timer->stop();
openScenarioFile();
}
void Controll::openScenarioFile()
{
clearPreviousScenario();
//opens new scenarioFile;
}
void Controll::clearPreviousScenario()
{
delete allocated stuff in heap;
clear all arrays/QVectors;
}
void Controll::finishAnim()
{
// loops the simulation if loop checkbox is checked
if (loopcheckBox->isChecked())
stopSim();
startSim(); // here it wont respond second time its supposed to
//restart the simulation. somehow the timeIncr() function is
not called, and is this because of the QTimer beeing started again? what
do you people think?
}
thanks in advance.
}
--
[ signature omitted ]