mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
feat: restart profile after core crash
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user