move qCallQueued
This commit is contained in:
@@ -44,20 +44,6 @@
|
||||
PIQt::qpiConnect(src, &decltype(PIQt::removePtr(src))::sig, tgt, &(tgt)->__stat_eh_##handler##__);
|
||||
|
||||
|
||||
/// much more compact and easy to use alternative to QMetaObject::invokeMethod(... , Qt::QueuedConnection)
|
||||
/// examples:
|
||||
/// qCallQueued(this, &MyClass::myFunc);
|
||||
/// qCallQueued(this, &MyClass::myFuncWithInt, 0xFF);
|
||||
/// qCallQueued(this, &MyClass::myFuncWithIntAndString, 0xAB, "string");
|
||||
template<typename O, typename F, typename... Args>
|
||||
void qCallQueued(O * o, F f, Args... args) {
|
||||
QMetaObject::invokeMethod(
|
||||
o,
|
||||
[o, f, args...]() { (o->*f)(args...); },
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
|
||||
namespace PIQt {
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -340,4 +340,18 @@ T qDeserialize(const QByteArray & data, int version = -1) {
|
||||
}
|
||||
|
||||
|
||||
/// much more compact and easy to use alternative to QMetaObject::invokeMethod(... , Qt::QueuedConnection)
|
||||
/// examples:
|
||||
/// qCallQueued(this, &MyClass::myFunc);
|
||||
/// qCallQueued(this, &MyClass::myFuncWithInt, 0xFF);
|
||||
/// qCallQueued(this, &MyClass::myFuncWithIntAndString, 0xAB, "string");
|
||||
template<typename O, typename F, typename... Args>
|
||||
void qCallQueued(O * o, F f, Args... args) {
|
||||
QMetaObject::invokeMethod(
|
||||
o,
|
||||
[o, f, args...]() { (o->*f)(args...); },
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
|
||||
#endif // QAD_TYPES_H
|
||||
|
||||
Reference in New Issue
Block a user