From bf11ca21c025e227e3c13cc20ec72b9ede53c4a2 Mon Sep 17 00:00:00 2001 From: peri4 Date: Tue, 4 Mar 2025 19:59:36 +0300 Subject: [PATCH] add IndexedTimer::stopAllIndexedTimers --- libs/piqt/qad_timers.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/piqt/qad_timers.h b/libs/piqt/qad_timers.h index 20cf069..491028f 100644 --- a/libs/piqt/qad_timers.h +++ b/libs/piqt/qad_timers.h @@ -31,15 +31,16 @@ template class QAD_UTILS_EXPORT IndexedTimer { public: - ~IndexedTimer() { - for (auto & i: timers) - i.destroy(); - timers.clear(); - } + ~IndexedTimer() { stopAllIndexedTimers(); } void setIndexedTimerType(Index index, Qt::TimerType type) { timers[index].type = type; } void setIndexedTimerSingleShot(Index index, bool yes) { timers[index].single_shot = yes; } void bindIndexedTimer(Index index, std::function func) { timers[index].func = func; } + void stopAllIndexedTimers() { + for (auto & i: timers) + i.destroy(); + timers.clear(); + } void stopIndexedTimer(Index index) { auto & t(timers[index]); if (!t.isValid()) return;