M
Size: a a a
SE
SE
Qt::QueuedConnection
AT
AT
AT
M
#include <QApplication>
void funcTest()
{
qDebug() << "in gui thread: " << QThread::currentThread();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QObject *context = new QObject;
QtConcurrent::run([=]{
qDebug() << "In another thread: " << QThread::currentThread();
QMetaObject::invokeMethod(context, [=](){
funcTest();
}, Qt::QueuedConnection);
});
return a.exec();
}
PM
#include <QApplication>
void funcTest()
{
qDebug() << "in gui thread: " << QThread::currentThread();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QObject *context = new QObject;
QtConcurrent::run([=]{
qDebug() << "In another thread: " << QThread::currentThread();
QMetaObject::invokeMethod(context, [=](){
funcTest();
}, Qt::QueuedConnection);
});
return a.exec();
}
PM
M
SE
#include <QApplication>
void funcTest()
{
qDebug() << "in gui thread: " << QThread::currentThread();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QObject *context = new QObject;
QtConcurrent::run([=]{
qDebug() << "In another thread: " << QThread::currentThread();
QMetaObject::invokeMethod(context, [=](){
funcTest();
}, Qt::QueuedConnection);
});
return a.exec();
}
M