int ScriptEngine::unsetAllTimers() { int i = 0; QHashIterator <QTimer*, QScriptValue> it (timerEvents); while (it.hasNext()) { it.next(); QTimer *timer = it.key(); timer->stop(); timer->blockSignals(true); timerEvents.remove(timer); timer->deleteLater(); i++; } return i; }
bool ScriptEngine::unsetTimer(int timerId) { QHashIterator <QTimer*, QScriptValue> it (timerEvents); while (it.hasNext()) { it.next(); QTimer *timer = it.key(); if (timer->timerId() == timerId) { timer->stop(); timer->blockSignals(true); timerEvents.remove(timer); timer->deleteLater(); return true; // Timer found. } } warn ("unsetTimer(timerId)", "no timer with that id"); return false; // No timer found. }