MyClass::MyClass(QWidget *parent):QWidget(parent){ QFuture <void> threadLoadInTable1; QFuture <void> threadLoadInTable2; threadLoadInTable1 = QtConcurrent::run(&MyClass::loadInTable1); threadLoadInTable2 = QtConcurrent::run(&MyClass::loadInTable2);}
threadLoadInTable1 = QtConcurrent::run(loadInTable1);
void function(void)
#include <QtGui/QApplication>#include <QDebug>#include <QtConcurrentRun>#include <QFuture>void func(){ for(int i = 0; i < 10; i++) qDebug() << i;}int main(int argc, char *argv[]){ QApplication a(argc, argv); QFuture <void> future = QtConcurrent::run(func); return a.exec();}
threadLoadInTable1 = QtConcurrent::run(&MyClass::loadInTable1);
QFuture <void> threadLoadInTable1 = QtConcurrent::run(this, &MyClass::loadInTable1);
QFuture <void> threadLoadInTable1 = QtConcurrent::run(MyClass, &MyClass::loadInTable1);