QtConcurrent::run(xxx)
1.打开QT Project Setting-》点击Qt Modules
2.头文件包含:
#include <QtConcurrent/QtConcurrent>
3.使用方法:
QFuture<void> future1 = QtConcurrent::run(this, &auto_pack_line_demo::UpdateVisionComm); //窗口按钮里面写法
//QFuture<void> future1 = QtConcurrent::run(UpdateVisionComm); //控制台的代码
future1.waitForFinished();
void auto_pack_line_demo::UpdateVisionComm()
{
qDebug() << "vision is updated...";
}