add IndexedTimer::stopAllIndexedTimers
This commit is contained in:
@@ -31,15 +31,16 @@
|
|||||||
template<typename Index = int>
|
template<typename Index = int>
|
||||||
class QAD_UTILS_EXPORT IndexedTimer {
|
class QAD_UTILS_EXPORT IndexedTimer {
|
||||||
public:
|
public:
|
||||||
~IndexedTimer() {
|
~IndexedTimer() { stopAllIndexedTimers(); }
|
||||||
for (auto & i: timers)
|
|
||||||
i.destroy();
|
|
||||||
timers.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setIndexedTimerType(Index index, Qt::TimerType type) { timers[index].type = type; }
|
void setIndexedTimerType(Index index, Qt::TimerType type) { timers[index].type = type; }
|
||||||
void setIndexedTimerSingleShot(Index index, bool yes) { timers[index].single_shot = yes; }
|
void setIndexedTimerSingleShot(Index index, bool yes) { timers[index].single_shot = yes; }
|
||||||
void bindIndexedTimer(Index index, std::function<void()> func) { timers[index].func = func; }
|
void bindIndexedTimer(Index index, std::function<void()> func) { timers[index].func = func; }
|
||||||
|
void stopAllIndexedTimers() {
|
||||||
|
for (auto & i: timers)
|
||||||
|
i.destroy();
|
||||||
|
timers.clear();
|
||||||
|
}
|
||||||
void stopIndexedTimer(Index index) {
|
void stopIndexedTimer(Index index) {
|
||||||
auto & t(timers[index]);
|
auto & t(timers[index]);
|
||||||
if (!t.isValid()) return;
|
if (!t.isValid()) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user