2016年10月11日火曜日

Qt thread run() に引数を入れたいと思ったら、代わりにQtConcurrentを使うといいよ

http://doc.qt.io/qt-4.8/qtconcurrentrun.html

Qt Creatorで使うときは.proファイルにQT += concurrent をつけよう
MainWindowクラス内で使うときは第一引数にthisを入れないと
Error: no matching function for callって言われちゃうよ たぶん
http://stackoverflow.com/questions/23702930/how-to-call-a-function-with-arguments-by-qtconcurrent


void MainWindow::Function(int i){}

void MainWindow::tekitou(){

    int u;

    QFuture future = QtConcurrent::run(this.Function, u);

}