Hi,
I have a QtConcurrent::run method that copies a pdf file from one directory to the next. This copying is in a separate thread because the pdf files can be quite large and to prevent the main GUI thread from being blocked from doing other tasks.
void MainWindow::CopyPDFsToDestDir()
{
//setup srcFile and destFile
...
QFile::copy(srcFile, destFile
);
}
QFuture<void> result = QtConcurrent::run(this, &MainWindow::CopyPDFsToDestDir);
void MainWindow::CopyPDFsToDestDir()
{
//setup srcFile and destFile
...
QFile::copy(srcFile, destFile);
}
QFuture<void> result = QtConcurrent::run(this, &MainWindow::CopyPDFsToDestDir);
To copy to clipboard, switch view to plain text mode
The QtConcurrent::run call is in a loop for x number of files depending on user selections.
It works great on my linux machine (RedHat) and files are copied one by one, but a customer states that on his linux machine (RedHat), the directory only contains 1-2 pdf files. Only after he closes the GUI, suddenly there are 20+ pdf files.
It is as if, the copying of pdf files are being buffered and only flushed upon closing of the GUI. Does this make any sense? ....isn't QFile::copy immediate? or perhaps the QtConcurrent::run threading the cause?
Bookmarks