| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <QObject> |
| 7 |
#include <utility> |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
template <typename T, typename F> |
| 15 |
static void QueueOnObject(T* obj, F&& func) |
| 16 |
{ |
| 17 |
QObject src; |
| 18 |
QObject::connect(&src, &QObject::destroyed, obj, std::forward<F>(func), Qt::QueuedConnection); |
| 19 |
} |
| 20 |
|
| 21 |
template <typename T, typename F> |
| 22 |
static void QueueOnObjectBlocking(T* obj, F&& func) |
| 23 |
{ |
| 24 |
QObject src; |
| 25 |
QObject::connect(&src, &QObject::destroyed, obj, std::forward<F>(func), |
| 26 |
Qt::BlockingQueuedConnection); |
| 27 |
} |