IndexedTimer type
This commit is contained in:
@@ -37,6 +37,7 @@ public:
|
||||
timers.clear();
|
||||
}
|
||||
|
||||
void setIndexedTimerType(Index index, Qt::TimerType type) { timers[index].type = type; }
|
||||
void bindIndexedTimer(Index index, std::function<void()> func) { timers[index].func = func; }
|
||||
void stopIndexedTimer(Index index) {
|
||||
auto & t(timers[index]);
|
||||
@@ -52,6 +53,7 @@ public:
|
||||
return;
|
||||
}
|
||||
t.timer = new QTimer();
|
||||
t.timer->setTimerType(t.type);
|
||||
QObject::connect(t.timer, &QTimer::timeout, t.func);
|
||||
t.timer->start(interval.toMilliseconds());
|
||||
}
|
||||
@@ -67,6 +69,7 @@ private:
|
||||
}
|
||||
std::function<void()> func = nullptr;
|
||||
QTimer * timer = nullptr;
|
||||
Qt::TimerType type = Qt::CoarseTimer;
|
||||
};
|
||||
|
||||
QMap<Index, __TimerSlot> timers;
|
||||
|
||||
Reference in New Issue
Block a user