I have a question, I am trying to find the most simple way (without eventloop and or QFutureWatcher) to run a function in a different thread without blocking the gui. I have an exporter object from other library, can not change it, and its Close() function takes about 15 seconds to close.
So I tried this trick below but it works only for a couple of seconds, but then the processEvents() function blocks until the Export function is finished which makes it useless.
My Code:
QFuture<void> future = QtConcurrent::run([&]() {exporter.Close();
qDebug() << "closed!";});
while (!future.isFinished())
{
QApplication::processEvents();
QThread::msleep(1); //yield
qDebug() << "z";
}