mmmmtse
13th October 2009, 17:46
Dear all QT Expert
I make a program of using the QTimer class and I create a QTimer in the Constructor as follows and every time the timer start it show up 2 repeat statment as follows :
system test 1
system test 1
system test 2
system test 2
It seems run 2 times every trigger with same slot. Is it some problems of my code or any statements missing to make this happen. Please help !!
My code
QTimer *sendtimer = new QTimer(this);
connect(sendtimer, SIGNAL(timeout()), this, SLOT(testprog()));
sendtimer->start(8000);
void ConfigurationPage::testprog()
{
qDebug() << "system test " << loopcount++;
return;
}
testdata = QString("system test %1").arg(loopcount);
qDebug() << testdata <<"\n";
I make a program of using the QTimer class and I create a QTimer in the Constructor as follows and every time the timer start it show up 2 repeat statment as follows :
system test 1
system test 1
system test 2
system test 2
It seems run 2 times every trigger with same slot. Is it some problems of my code or any statements missing to make this happen. Please help !!
My code
QTimer *sendtimer = new QTimer(this);
connect(sendtimer, SIGNAL(timeout()), this, SLOT(testprog()));
sendtimer->start(8000);
void ConfigurationPage::testprog()
{
qDebug() << "system test " << loopcount++;
return;
}
testdata = QString("system test %1").arg(loopcount);
qDebug() << testdata <<"\n";