Calling QtConcurrent::run freez my GUI

625 views Asked by At

I call in a method1 (private slot) a method2 (private) asynchron with QtConcurrent::run. Sometimes it works well but sometimes my gui freez and I can't do anything more...

void myclass::method1() {
     .....
     // do some stuff
     .....
     QFuture<void> result = QtConcurrent::run(this, method2, "string", "string");
}

void myclass::method2( QString one, QString two ) {
     for (int i, i < 1000; i++) {
         QString tmp;
         m_textEdit->append( tmp.setNum( i ) + one + two );
     }
}

Somebody some ideas?

0

There are 0 answers