feat: restart profile after core crash

This commit is contained in:
arm64v8a
2022-10-18 17:15:49 +08:00
parent b46cd2da3d
commit 2e991b675d
6 changed files with 35 additions and 7 deletions

View File

@@ -107,3 +107,14 @@ void runOnUiThread(const std::function<void()> &callback, QObject *parent) {
void runOnNewThread(const std::function<void()> &callback) {
createQThread(callback)->start();
}
void setTimeout(const std::function<void()> &callback, QObject *obj, int timeout) {
auto t = new QTimer;
QObject::connect(t, &QTimer::timeout, obj, [=] {
callback();
t->deleteLater();
});
t->setSingleShot(true);
t->setInterval(timeout);
t->start();
}