Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be
on-topic
here, this one was resolved in a way less likely to help future readers.
Closed
9 years ago
.
I am trying to use QTimer and I is starting well, but When I am trying to stop it by checking its state using isActive, it returning false always but the code inside the slot for timer is executing in correct interval.
here is code
void CurrentController::currentAction(void)
count++;
QTimer *timer = new QTimer(this);
if(count == 1)
qDebug()<< "Count" << count;
QObject::connect(timer, SIGNAL(timeout()), this, SLOT(callMethod()));
timer->setInterval(10000);
timer->start();
for stopping timer
if(count >= 2)
qDebug()<< "Count2" <<timer->isActive();
timer->stop();
count = 0;
Help appreciated thanks...
–
–
–
Yet, here you're checking if some d->timer
is active:
qDebug()<< "Count2" << d->timer->isActive();
And a line later you refer to timer
, not d->timer
again:
timer->stop();
Maybe you need to decide which timer you wish to use, and stick with it :)
–
–
–
–
–