Is it possible to load a PDF asynchronously using QtPDF?
I'm trying to load a PDF in a Qt Widget application using threading. Irrespective of what I do, it fails to load the PDF. I tried creating a concurrent thread, made a new QPdfDocument, loaded a PDF into the entity and then moved it to the main thread before returning the pointer. It still doesn't work! Here is an MWE (I know that the PDF loading in this example is synchronous, but even this fails to work - forget about loading the PDF asynchronously):
QFuture<QPdfDocument*> future = QtConcurrent::run([](){
QPdfDocument* loadDoc = new QPdfDocument();
loadDoc->load(ProjectSettings::instance().pdfPath);
loadDoc->moveToThread(QApplication::instance()->thread());
return loadDoc;
});
m_document = future.result();